[英]devtools::install(): Installing R package which imports another package that is stored locally
I am trying to build R packages locally simply to standardize my code for my own benefit. 我试图在本地构建R包,只是为了我自己的利益标准化我的代码。 I've no intention to post on CRAN or GitHub.
我无意在CRAN或GitHub上发帖。 What I would like to do is import packages I've already developed into a new package I'm developing.
我想要做的是将我已经开发的包导入到我正在开发的新包中。
For example: 例如:
The problem I'm facing is that when I install pack_b (using devtools::install()
) the following error comes up: 我面临的问题是,当我安装pack_b(使用
devtools::install()
)时会出现以下错误:
Skipping 1 unavailable package: pack_a
After looking through the code of devtools on GitHub it appears that it is looking on CRAN for the required packages using available.packages()
. 在浏览GitHub上的devtools代码之后,看来它正在使用
available.packages()
在CRAN上查找所需的包。 Of course my pack_a is not on CRAN so it fails to find it and then pack_b fails to install. 当然我的pack_a不在CRAN上,因此无法找到它然后pack_b无法安装。 I was hoping it would first check if pack_a is already installed in my default library and therefore not even try to re-install it.
我希望它首先检查pack_a是否已经安装在我的默认库中,因此甚至不会尝试重新安装它。
So my question comes down to: 所以我的问题归结为:
How do I specify where to find pack_a on my local drive when installing pack_b ? 如何在安装pack_b时指定在本地驱动器上找到pack_a的 位置 ? And if that's not possible is there a switch to turn off installation of required packages during install?
如果不可能,那么在安装过程中是否会关闭所需软件包的安装?
A similar question was asked before and I'm not entirely sure but I think one of the suggestions was to add your local path to the repos
argument of install.packages()
. 之前有一个类似的问题,我不完全确定,但我认为其中一个建议是将本地路径添加到
install.packages()
的repos
参数中。 This did not work for me however. 然而,这对我不起作用。
Previous similar question: R package which imports SparkR (not on CRAN) 上一个类似的问题: R包导入SparkR(不在CRAN上)
Any guidance would be much appreciated. 任何指导都将非常感谢。
I'm not entirely sure why you are having this issue without more details, as I do exactly as you describe for my own packages (both also not on CRAN) and have no issues. 我不完全确定为什么你在没有更多细节的情况下遇到这个问题,正如我为你自己的包描述的那样(两者也不在CRAN上)并且没有问题。
Having said that, a simple solution if you know for sure that pack_a
is installed before you install pack_b
is to run: 话虽如此,一个简单的解决方案,如果你肯定知道
pack_a
安装前安装pack_b
是运行:
devtools::install(dependencies = FALSE)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.