簡體   English   中英

在Rstudio中使用Rcpp安裝R包的終端命令?

[英]Terminal commands to install R packages with Rcpp like in Rstudio?

在使用R代碼時,我最近從Rstudio轉到vim。 當我在Rstudio中單擊“ Install and Restart時,我無法理解如何復制發送的命令。

據我了解,我需要跑

Rscript -e "Rcpp::compileAttributes()"
Rscript -e "devtools::document()"

復制Rstudio的Document按鈕。 然后

Rscript -e "Rcpp::compileAttributes()"
R CMD INSTALL --no-multiarch --with-keep.source .

應該復制“ Install and Restart按鈕。

問題是:使用Rstudio的按鈕安裝包很好,而運行命令不會。 嘗試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

如果我忽略它並只安裝包,那么包中唯一可用的對象是my_kpg::'.__t__[[:base' 如何構造一系列與Rstudio的DocumentInstall and Restart按鈕相同的命令行輸入?

事實證明,當交互式R會話發生時, Rscript默認不加載methods包(很奇怪)。 問題是由於缺少包裹造成的。

library(methods)添加到我的.Rprofile文件解決了這個問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM