read.table(url...) 在 RStudio 中出错
Error in RStudio with read.table(url...)
我尝试在 RStudio 中 运行 下面的代码,它总是 returns 连接失败的错误信息。它适用于 RGui。知道这是为什么以及如何解决它吗?我的 Rstudio 有问题吗(我是 运行ning Windows 8)?
survey <- read.table(url("ftp://ftp.ics.uci.edu/pub/machine-learning-databases/adult/adult.data"),
header=FALSE, sep=",", quote="", stringsAsFactors=FALSE)
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
InternetOpenUrl failed: 'The FTP session was terminated
b'
我试过的替代代码:
survey <- read.table(url('ftp://ftp.ics.uci.edu/pub/machine-learning-databases/adult/adult.data'),
header=FALSE, sep=",", quote="", stringsAsFactors=FALSE)
survey <- read.table('ftp://ftp.ics.uci.edu/pub/machine-learning-databases/adult/adult.data',
header=FALSE, sep=",", quote="", stringsAsFactors=FALSE)
谢谢!
RStudio 和 RGUI 可能对 setInternet2()
使用不同的默认值,因此请在会话开始时尝试 运行 setInternet2(use=FALSE)
。
这是 RStudio (2013) 的解释:
Also we call setInternet2(use=TRUE)
on startup which takes proxy
settings from Internet Explorer to make proxies work in the majority
of cases. We also have an open bug to allow users to turn this off on
startup, but for now you'll have to call setInternet2(use=FALSE)
manually for each session. For more information on the command, call
the following from the console: ?setInternet2()
https://support.rstudio.com/hc/communities/public/questions/200657716-Rstudio-with-aproxy
对于 Windows,您可以选择在 RStudio 中关闭此功能,因为 Windows 的人提到了以下解决方案(2014):
One solution was to go to Tools > Global Options > Packages, and
unselect "Use Internet Explorer library/proxy for HTTP".
我尝试在 RStudio 中 运行 下面的代码,它总是 returns 连接失败的错误信息。它适用于 RGui。知道这是为什么以及如何解决它吗?我的 Rstudio 有问题吗(我是 运行ning Windows 8)?
survey <- read.table(url("ftp://ftp.ics.uci.edu/pub/machine-learning-databases/adult/adult.data"),
header=FALSE, sep=",", quote="", stringsAsFactors=FALSE)
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
InternetOpenUrl failed: 'The FTP session was terminated
b'
我试过的替代代码:
survey <- read.table(url('ftp://ftp.ics.uci.edu/pub/machine-learning-databases/adult/adult.data'),
header=FALSE, sep=",", quote="", stringsAsFactors=FALSE)
survey <- read.table('ftp://ftp.ics.uci.edu/pub/machine-learning-databases/adult/adult.data',
header=FALSE, sep=",", quote="", stringsAsFactors=FALSE)
谢谢!
RStudio 和 RGUI 可能对 setInternet2()
使用不同的默认值,因此请在会话开始时尝试 运行 setInternet2(use=FALSE)
。
这是 RStudio (2013) 的解释:
Also we call
setInternet2(use=TRUE)
on startup which takes proxy settings from Internet Explorer to make proxies work in the majority of cases. We also have an open bug to allow users to turn this off on startup, but for now you'll have to call setInternet2(use=FALSE) manually for each session. For more information on the command, call the following from the console:?setInternet2()
https://support.rstudio.com/hc/communities/public/questions/200657716-Rstudio-with-aproxy
对于 Windows,您可以选择在 RStudio 中关闭此功能,因为 Windows 的人提到了以下解决方案(2014):
One solution was to go to Tools > Global Options > Packages, and unselect "Use Internet Explorer library/proxy for HTTP".