目前存在从 CRAN 中拉出时无法编译的依赖项依赖项,因此维护者提供了替代方法Cannot compile RcppArmadillo

RcppArmadillo我试图像这样从那个路径安装:

if(!require("RcppArmadillo")) install.packages("RcppArmadillo", repos="https://rcppcore.github.io/drat", lib = LIB_PATH)
library(RcppArmadillo)

if(!require("sqjin/scAI")) devtools::install_github("sqjin/scAI", lib = LIB_PATH)
library(scAI, lib.loc = LIB_PATH)

RcppArmadillo但是,我可以在仍在从中提取的日志中看到CRAN

如何从自定义存储库强制安装?


通过在您的(用户或系统)启动文件之一中设置您的(命名向量)参数,您可以让 R知道options("repos")备用位置。之后 R 将选择最高(==“最新”)版本(数字)。

help(Startup)这是显示一种方法的块:

 ## Example of Rprofile.site
 local({
   # add MASS to the default packages, set a CRAN mirror
   old <- getOption("defaultPackages"); r <- getOption("repos")
   r["CRAN"] <- "http://my.local.cran"
   options(defaultPackages = c(old, "MASS"), repos = r)
   ## (for Unix terminal users) set the width from COLUMNS if set
   cols <- Sys.getenv("COLUMNS")
   if(nzchar(cols)) options(width = as.integer(cols))
   # interactive sessions get a fortune cookie (needs fortunes package)
   if (interactive())
     fortunes::fortune()
 })

你可以在哪里使用

   r["CRAN"] <- "https://cloud.r-project.org"
   r["Rcpp"] <- "https://RcppCore.github.io/drat"

由于 RcppCore 存储库是一个drat存储库,您还可以查阅drat包含其他示例和帮助程序的文档。