带有安装r软件包的问题

问题描述 投票:0回答:4
在install.packages中亮:

InternetOpenUrl failed: 'Can not connect to server'
    

这是在R和Rstudio偶尔出现的东西。 rstudio更改了许多设置,并且选项

"repos"

是其中之一。在Windows上,添加以下内容


r rstudio r-package
4个回答
17
投票

> getOption("repos") CRAN CRANextra "https://cran.rstudio.com/" "http://www.stats.ox.ac.uk/pub/RWin" attr(,"RStudio") [1] TRUE

SORSTUDIO试图在Windows上运行时访问特定的存储库,但是该存储库过去曾有一些连接问题。它并不总是可到达的,而当您报告的警告不会发出。 
您可以通过重置此选项来引起此警告以停止:

options(repos = "https://cran.rstudio.com") # or a repo of your choice.

允许您安装软件包而无需警告:

> install.packages("fortunes") trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/fortunes_1.5-4.zip' Content type 'application/zip' length 202721 bytes (197 KB) downloaded 197 KB package ‘fortunes’ successfully unpacked and MD5 sums checked The downloaded binary packages are in C:\Users\Joris\AppData\Local\Temp\Rtmpu0febg\downloaded_packages

即将显示此警告时,包裹仍然从rstudio cran镜像中安装。警告被称为bug

,Rstudio已承诺尽快解决。
Edit:有关cranextra存储库的更多信息(最后一段)

  
没有在窗户上开箱即用的一些奶油包装, 需要其他软件,或者要运送第三方图书馆 窗口无法以Windows二进制的形式在Cran上提供 软件包。但是,其中一些包裹可在 “ Cran Extras”存储库,位于

Https://www.stats.ox.ac.ac.uk/pub/rwin/ 由Brian D. Ripley提供。请注意,此存储库是一个 Windows R的最新版本的默认存储库。

在R Studio修复错误时的平均值,这是每次我们启动R会话时不必尤其不需要cran存储库的时间解决方案,就是编辑您的“ rprofile.stoite.site”文件并添加此行

options(repos = getOption("repos")["CRAN"])

每次启动r会话时,cranextra存储库(“ http://www.stats.ox.ac.ac.uk/pub/rwin

”)会自动删除。请记住,在解决错误之后,请删除或评论#。

5
投票
I正面临类似的问题,对我有用的修复程序是,在rstudio中,我打开了工具 - > global选项 - > packages-> primary cran repository-> setglobal.

此外,请确保您不要使用installed.packages

packages this this at tht the Mose Mose to rstudio键入建议。 您需要使用

Install.packages(“
”)


0
投票

添加以下内容到

.RprifileRprofile.site # fixing the CRANextra warnings when installing packages # the following two chucks of scripts will/may run from start of R local({ r <- getOption("repos") # Get the current repositories r <- r[names(r) != "CRANextra"] # Remove CRANextra options(repos = r) # Update the repositories }) # the cloudyr project # https://cloudyr.github.io/drat/ if (!require("drat")) { install.packages("drat") library("drat") drat::addRepo("cloudyr", "http://cloudyr.github.io/drat") # Add coudyr to repositories }


0
投票

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.