使用R的devtools库函数“安装”时如何保存源文件 [英] How do i keep source files when using R's devtools library function 'install'

查看:163
本文介绍了使用R的devtools库函数“安装”时如何保存源文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从源代码构建R包(DESeq2),以便可以对其进行调试。我已经安装了所有必需的依赖项,并且正在关注Hillary Parker的用于创建R包的指令。我正在R-3.4.2。的CentOS 6.6上运行它。

I am trying to build an R package (DESeq2) from source so that I can debug it. I've installed all the dependencies required and I'm following Hillary Parker's instructions for creating R packages. I'm running this on CentOS 6.6 using R-3.4.2.

我运行:

library("devtools")
install("DESeq2", keep_source=TRUE)

它将它与其他所有R库一起安装在目录中。当我查看已安装的DESeq2库时,它缺少 all DESeq2 / R / *。R DESeq2 / src / *。cpp 文件。

It installs it in the directory with all my other R libraries. When I look at the installed DESeq2 library it is missing all the DESeq2/R/*.R and DESeq2/src/*.cpp files.

问题:这些文件在哪里,为什么不安装它们?

QUESTION : Where are these files and why didn't they get installed? This does not seem like the expected behavior.

推荐答案

R使用二进制数据库格式的已安装软件包将对象打包到数据库中。出于效率原因(延迟加载),类似文件格式。这些数据库文件( *。rdb *。rdx )存储在软件包安装路径的R子文件夹中。 (请参见?lazyLoad )。

R uses binary database format for installed packages to pack the objects into a database-alike file format for efficiency reasons (lazy loading). These database files (*.rdb and *.rdx) are stored in the R sub folder of the package installation path (see ?lazyLoad).

即使


  • 您正在寻找合适的位置来找到已安装的软件包(在R中使用 .libPaths()查找安装文件夹)

  • ,并且您已经安装了带有源代码的软件包(就像您通过 install.packages( a_CRAN_package,INSTALL_opts = --with-keep .source)

  • you are looking at the right place to find the installed package (use .libPaths() in R to find the installation folder)
  • and you have installed the package with the source code (like you did or via install.packages("a_CRAN_package", INSTALL_opts = "--with-keep.source"))

您不会在R文件夹中找到R文件。

you will not find R files in R folder there.

您可以通过从包中选择一个函数名称并将其打印在控制台上来验证源代码是否可用。如果您可以看到源代码(带有注释),则可以使用软件包的源文件(R文件):

You can verify that the source code is available by picking one function name from the package and print it on the console. If you can see the source code (with comments) the package sources (R files) are available:

print(DeSeq2 :: any_function)

要使源代码可用于调试和堆栈跟踪,可以设置选项 keep.source.pkgs = TRUE (请参见?options )在您的 .Rprofile 文件中或通过环境变量:

To make the source code available for debugging and stack traces you can set the option keep.source.pkgs = TRUE (see ?options) in your .Rprofile file or via an environment variable:


keep.source.pkgs:

keep.source.pkgs:

keep.source仅用于安装软件包
时。除非环境变量
R_KEEP_PKG_SOURCE设置为yes,否则默认为FALSE。

As for keep.source, used only when packages are installed. Defaults to FALSE unless the environment variable R_KEEP_PKG_SOURCE is set to yes.

注意:源代码仅适用于新安装和更新的软件包(不适用于已安装的软件包!)。

Note: The source code is available then only for newly installed and updated packages (not for already installed packages!).

有关更多详细信息,请参见: https://yetanothermathprogrammingconsultant.blogspot.de/2016/02/r-lazy-load-db-files.html

For more details see: https://yetanothermathprogrammingconsultant.blogspot.de/2016/02/r-lazy-load-db-files.html

这篇关于使用R的devtools库函数“安装”时如何保存源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆