R下载文件cannot open the connection,InternetOpenUrl failed 问题

Rstudio 下载一个文件出现InternetOpenUrl failed 问题

> source("http://www.statmethods.net/RiA/wmc.txt")
Error in file(filename, "r", encoding = encoding) : 
  cannot open the connection
In addition: Warning message:
In file(filename, "r", encoding = encoding) :
  InternetOpenUrl failed: '安全频道支持出错'

1. 第一种方法,修改options

> options(download.file.method="libcurl", url.method="libcurl")
> source("http://www.statmethods.net/RiA/wmc.txt")
> wmc

成功

第二种解决方式,修改Rstudio的设置

设置Rstudio,Tools > Global Options > Packages, “Use Internet Explorer library/proxy for HTTP”,取消打钩。因为第一种方法已经可以,所以这种方式我没试过。供参考。

猜你喜欢

转载自blog.csdn.net/weixin_44022515/article/details/104060358