RStudio 中的更新包不起作用

Update packages in RStudio doesn't work

单击“更新包”会导致弹出窗口 window 显示 "R Error",然后在控制台中打印出错误:

Error in if (substr(cranRep, cranRepLen, cranRepLen) != "/") cranRep <- 
paste(cranRep,  :missing value where TRUE/FALSE needed

我有一个用于启动的 .Rprofile。

对于 a little digging into Github,答案似乎是在 .Rprofile 中指定以下内容:

options(repos=c(CRAN="https://cran.rstudio.com/"))

相对于

options(repos="https://cran.rstudio.com/")

我遇到了同样的问题,即缺少 TRUE/FALSE 需要的值

R 和 RStudio 版本
  • R Studio 1.0.143
  • R 3.4.0

我通过编辑 Rprofile.site 解决了。以下是步骤:

第一步: 转到 C:\Program Files\R\R-3.4.0\etc 或 Rprofile.site 为

的位置

第 2 步: 打开Rprofile.site。并将 "Set Cran mirror" 编辑为

    local({r <- getOption("repos")
    r["CRAN"] <- "https://cran.rstudio.com/"
    options(repos=r)})

第 3 步: 如有必要,请重新启动 RStudio