2016-04-24 56 views
0

我有麻烦与网络安装包:为什么在RCurl :: getURL是install.packages和download.file时不工作?

> install.packages("qualV") 
Warning in install.packages : 
    InternetOpenUrl failed: 'The server name or address could not be resolved' 
Warning in install.packages : 
    InternetOpenUrl failed: 'The server name or address could not be resolved' 
Warning in install.packages : 
    unable to access index for repository https://mirror.ibcp.fr/pub/CRAN/src/contrib 
Warning in install.packages : 
    InternetOpenUrl failed: 'The server name or address could not be resolved' 
Warning in install.packages : 
    InternetOpenUrl failed: 'The server name or address could not be resolved' 
Warning in install.packages : 
    unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/src/contrib 
Warning in install.packages : 
    InternetOpenUrl failed: 'The server name or address could not be resolved' 
Warning in install.packages : 
    InternetOpenUrl failed: 'The server name or address could not be resolved' 
Warning in install.packages : 
    unable to access index for repository https://mirror.ibcp.fr/pub/CRAN/src/contrib 
Warning in install.packages : 
    InternetOpenUrl failed: 'The server name or address could not be resolved' 
Warning in install.packages : 
    InternetOpenUrl failed: 'The server name or address could not be resolved' 
Warning in install.packages : 
    unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/src/contrib 
Warning in install.packages : 
    package ‘qualV’ is not available (for R version 3.2.2) 
Warning in install.packages : 
    InternetOpenUrl failed: 'The server name or address could not be resolved' 
Warning in install.packages : 
    InternetOpenUrl failed: 'The server name or address could not be resolved' 
Warning in install.packages : 
    unable to access index for repository https://mirror.ibcp.fr/pub/CRAN/bin/windows/contrib/3.2 
Warning in install.packages : 
    InternetOpenUrl failed: 'The server name or address could not be resolved' 
Warning in install.packages : 
    InternetOpenUrl failed: 'The server name or address could not be resolved' 
Warning in install.packages : 
    unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.2 

我检查了仓库,代理,并设置调试信息:

> options(internet.info = 0) 
> options()$repos 
           CRAN       CRANextra 
    "https://mirror.ibcp.fr/pub/CRAN/" "http://www.stats.ox.ac.uk/pub/RWin" 
attr(,"RStudio") 
[1] TRUE 
> 
> Sys.getenv("http_proxy") 
[1] "" 
> Sys.getenv("https_proxy") 
[1] "" 

我已经选中:R-studio->Tools->Global Options->Use Internet Explorer library/proxy for HTTP(我也尝试没有R-工作室与相同的结果)

看来问题纯的R是与网络连接的:

> url.link <- "https://stat.ethz.ch/R-manual/R-devel/library/utils/html/download.file.html" 
> content <- download.file(url.link, destfile = "download.file.html") 
trying URL 'https://stat.ethz.ch/R-manual/R-devel/library/utils/html/download.file.html' 
Error in download.file(url.link, destfile = "download.file.html") : 
    cannot open URL 'https://stat.ethz.ch/R-manual/R-devel/library/utils/html/download.file.html' 
In addition: Warning message: 
In download.file(url.link, destfile = "download.file.html") : 
    InternetOpenUrl failed: 'The server name or address could not be resolved' 

这里说到有趣的地方,看来这个问题不上网:

> library(RCurl) 
> content <- getURL(url.link) 
> nchar(content) 
[1] 13537 

为什么install.packagesdownload.file不同时getURL工作是工作?

PS:操作系统是在企业笔记本上运行的Windows 7,所以有AV/FW安装,我不能禁用(我不是admininstrator)。

回答

0

这是一个猜测。

我认为你有一个RStudio的新版本,但是R的旧版本。根据我的经验,如果你只使用R,即不通过RStudio,则可以安装该软件包。我建议将R和RStudio更新为最新版本。


我认为这个问题的产生是因为RStudio强制HTTPS,这是只有在R.

+0

的后续版本推出,我做到了这一点,但结果是一样的前面。然后我在Internet Explorer中禁用了代理并启用了'R-studio-> Tools->全局选项 - >使用Internet Explorer库/ HTTP代理。现在它正在工作。谢谢。 –

相关问题