[英]Terminal commands to install R packages with Rcpp like in Rstudio?
I'm recently moving from Rstudio to vim when working with R code. 在使用R代码时,我最近从Rstudio转到vim。 I'm having trouble understanding how to replicate the commands sent when I click
Install and Restart
in Rstudio. 当我在Rstudio中单击“
Install and Restart
时,我无法理解如何复制发送的命令。
As far as I understand, I need to run 据我了解,我需要跑
Rscript -e "Rcpp::compileAttributes()"
Rscript -e "devtools::document()"
to replicate Rstudio's Document
button. 复制Rstudio的
Document
按钮。 Then 然后
Rscript -e "Rcpp::compileAttributes()"
R CMD INSTALL --no-multiarch --with-keep.source .
should replicate the Install and Restart
button. 应该复制“
Install and Restart
按钮。
The problem is: Using Rstudio's buttons installs the package just fine, while running the commands wont. 问题是:使用Rstudio的按钮安装包很好,而运行命令不会。 When trying to
document()
I get the following error: 尝试
document()
出现以下错误:
Updating mypkg documentation
Writing NAMESPACE
Loading mypkg
Error in representation(N = "numeric", N_dep = "numeric", vertices = "list", : could not find function "representation"
Calls: <Anonymous> ... source_many -> source_one -> eval -> eval -> setClass -> is
Execution halted
And if I ignore it and just install the package, the only object available in the package is my_kpg::'.__t__[[:base'
. 如果我忽略它并只安装包,那么包中唯一可用的对象是
my_kpg::'.__t__[[:base'
。 How can I construct a sequence of command line inputs that behave identically to Rstudio's Document
and Install and Restart
buttons? 如何构造一系列与Rstudio的
Document
和Install and Restart
按钮相同的命令行输入?
It turns out Rscript
doesn't load the methods
package by default while the interactive R session does (weird). 事实证明,当交互式R会话发生时,
Rscript
默认不加载methods
包(很奇怪)。 The problem was caused by the missing package. 问题是由于缺少包裹造成的。
Adding library(methods)
to my .Rprofile
file solved the issue. 将
library(methods)
添加到我的.Rprofile
文件解决了这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.