install.packages 中的警告:无法访问存储库的索引

mar*_*gue 4 r

安装 R 版本 4.2.0 后,我突然无法从 CRAN 安装软件包。这仅在我的具有强大防火墙的办公室站点上是正确的。

\n

警告消息粘贴如下:

\n
> Warning in install.packages: unable to access index for repository\n> http://cran.rstudio.com/src/contrib: cannot open URL\n> 'http://cran.rstudio.com/src/contrib/PACKAGES' Installing package into\n> \xe2\x80\x98C:/Users/l2863/AppData/Local/R/win-library/4.2\xe2\x80\x99 (as \xe2\x80\x98lib\xe2\x80\x99 is\n> unspecified) Warning in install.packages: unable to access index for\n> repository http://cran.rstudio.com/src/contrib: cannot open URL\n> 'http://cran.rstudio.com/src/contrib/PACKAGES'\n
Run Code Online (Sandbox Code Playgroud)\n

我查看了类似的问题,但没有找到任何有效的解决方案。

\n

小智 6

在这里找到了一个解决方案,它与我在 Windows 上使用 R studio 一起工作

\n

转到工具 -> 全局选项 -> 包 -> 管理选项卡 -> 取消选中“使用 HTTP 安全下载方法”

\n

在此输入图像描述

\n

但是,如果您希望保持 https 连接来安装 R 包,请参阅此链接了解更多详细信息

\n
\n

如果您启用了此选项但仍然收到警告消息,则您可能需要选择支持 HTTPS 的备用 CRAN 镜像。下面在安全 CRAN 镜像中列举了当前已知支持 HTTPS 的镜像。您也可能在 .Rprofile 中手动指定了不支持安全下载的下载方法或 CRAN 镜像

\n
\n