由于与网络安全系统冲突,我只能通过R本身下载数据文件到网络中可用于R的区域。当我在RStudio中运行脚本时,它可以正常工作。但是当我尝试编织脚本时,我会收到"Unsupported URL"消息。
Error in file(file, "rt") : cannot open the connection
Calls: <Anonymous> ... withVisible -> eval -> eval -> read.csv ->
read.table -> file
Execution halted
以下是在正常运行时可以工作但在编织过程中无法工作的代码。
url <- "https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2Factivity.zip"
download.file(url, "repdata-data-activity.zip")
unzip("repdata-data-activity.zip")
如果文件不是zip格式,我可以使用
RCurl
下载,但是当我尝试这样做时,R崩溃了。我也尝试了 method = "curl",setInternet2(TRUE)
,并尝试从https
中删除s
,但都没有成功。结果是我无法生成一个正常的文档,这是个问题。我之前遇到过非常类似的问题(CSV文件而不是压缩的CSV文件,请参见下面的链接),并尝试了建议,但没有成功: R produces "unsupported URL scheme" error when getting data from https sites 我正在使用Windows 7和RStudio。
重申一下:只有在编织文档时才会出现这个问题,运行脚本时没有问题。