解决方案
使用
devtools::install()
相反。
解释
根据
RStudio website
,
Build and Reload命令按顺序执行几个步骤,以确保得到干净、正确的结果:
1.卸载包的任何现有版本(必要时包括共享库)。
2.使用R CMD INSTALL构建和安装包。
3.重新启动底层R会话,以确保重新加载包的环境干净。
4.通过执行库函数在新的R会话中重新加载包。
devtools::install()
将为您安装依赖项--从
help("install.packages")
:
使用R CMD INSTALL安装包。威尔
尝试安装
来自CRAN的包的依赖项,如果它们还没有
安装。
(强调补充)这不是
R CMD INSTALL
独自一人(见
?INSTALL
从R或
R CMD INSTALL --help
所以,它似乎是一种语言
尚未存在,请安装到您的计算机上
从哈德利那里
R Packages
有点具体;它不适用于使用
R命令安装
(RStudio的build函数显然使用了这个函数),但确实适用于
. 这是个人品味的问题,但老实说,我强烈建议使用
devtools
在包开发工作流中。
例子
rbenchmark
从我的系统通过
remove.packages("rbenchmark")
然后创建一个虚拟包
devtools::create("SOexample", rstudio = FALSE)
本奇马克
在进口中
SOexample
看情况而定。我在中添加了以下代码
R/hello_world.R
:
hello_world <- function() print("Hello, world!")
R命令安装
,但出现了错误
*安装到library/home/duckmayr/R/x86_64-pc-linux-gnu-library/3.5
*删除/home/duckmayr/R/x86_64-pc-linux-gnu-library/3.5/soe示例
devtools::install()
:
> devtools::install("SOexample/")
Installing SOexample
trying URL 'https://cloud.r-project.org/src/contrib/rbenchmark_1.0.0.tar.gz'
Content type 'application/x-gzip' length 5093 bytes
==================================================
downloaded 5093 bytes
Installing rbenchmark
'/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet \
CMD INSTALL '/tmp/RtmpA0NOMe/devtools723832018149/rbenchmark' \
--library='/home/duckmayr/R/x86_64-pc-linux-gnu-library/3.5' --install-tests
* installing *source* package ârbenchmarkâ ...
** package ârbenchmarkâ successfully unpacked and MD5 sums checked
** R
** demo
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (rbenchmark)
'/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet \
CMD INSTALL '/home/duckmayr/SOexample' \
--library='/home/duckmayr/R/x86_64-pc-linux-gnu-library/3.5' --install-tests
* installing *source* package âSOexampleâ ...
** R
** byte-compile and prepare package for lazy loading
** help
No man pages found in package âSOexampleâ
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (SOexample)