R:不能使用 0-cloud 来 install.packages

R: Cannot use 0-cloud to install.packages

当我尝试从 0-cloud 安装软件包时它不起作用

> install.packages("lfactors")
--- Please select a CRAN mirror for use in this session ---

然后我 select 从存储库列表中选择 0-cloud。和 R returns

Warning: unable to access index for repository https://cran.rstudio.com/src/contrib
Warning: unable to access index for repository https://cran.rstudio.com/bin/windows/contrib/3.2
Warning message:
package ‘lfactors’ is not available (for R version 3.2.1) 

但是,当我 运行 这段代码和 select 另一个存储库时它确实有效。

我试过关闭我的代理服务器,并在打开代理服务器的情况下访问该站点,我可以在浏览器中毫无问题地访问它。

有什么想法吗?

编辑: 根据评论,我 运行 这个

capabilities()["libcurl"]
libcurl 
   TRUE

所以我认为不是那样。

您的 R 二进制文件可能是在不支持 curl 的情况下构建的,您无法访问 https 服务器。看看这个returns:

R> capabilities()["libcurl"]
libcurl 
   TRUE 
R> 

如果这 FALSE 适合你,请做两件事:

  1. 更改 options("repos") 以使用 http 而不是 https。

  2. 重建 R 以获得 libcurl 支持。

我在 Rprofile.site 中这样做:

## Example of Rprofile.site
local({
    r <- getOption("repos")
    r["CRAN"] <- "http://cran.rstudio.com"    ## not https for you
    options(repos = r)
})

编辑:另一种可能性,特别是在 Windows 上,是必须激活 internet2 dll,因此 运行 setInternet2(TRUE) 一次应该会有所帮助。