R Download.file功能似乎不起作用

R Download.file功能似乎不起作用,r,R,我想在线将.csv的一些数据提取到R中,因此我正在这样做(我已经创建了一个名为“data”的目录) 如果我删除method=“curl”我会得到 Error in download.file(fileUrl, destfile = "./data/cameras.csv") : unsupported URL scheme 有什么想法吗?注意http而不是https,下面的代码可以工作: fileUrl我也有这个问题。将method=“curl”更改为method=“auto”对我很有效。您

我想在线将.csv的一些数据提取到R中,因此我正在这样做(我已经创建了一个名为“data”的目录)

如果我删除
method=“curl”
我会得到

Error in download.file(fileUrl, destfile = "./data/cameras.csv") : 
unsupported URL scheme
有什么想法吗?

注意http而不是https,下面的代码可以工作:
fileUrl我也有这个问题。将method=“curl”更改为method=“auto”对我很有效。

您的代码对我很有效
method=“curl”
对于Mac OS是必需的,如果地址是
https
则很可能(但我不反对)对于Windows也是必需的,所以不要删除它。如果您在Windows上,请尝试
setInternet2(TRUE)
。URI中是否有换行符或其他空格字符(如制表符)?如果是这样,请将所有内容放在一行,不留空格。Thanks@BrandonBertelsen这很有帮助。现在工作很好。setInternet2(TRUE)到底在做什么?@user3706202:
 Warning messages:
 1: running command 'curl  "https://data.baltimorecity.gov/api/views/dz54-     2aru/rows.csv?accessType=DOWNLOAD"  -o "./data/cameras.csv"' had status    127 
 2: In download.file(fileUrl, destfile = "./data/cameras.csv", method  = "curl") download had nonzero exit status
Error in download.file(fileUrl, destfile = "./data/cameras.csv") : 
unsupported URL scheme
fileUrl <- "http://data.baltimorecity.gov/api/views/dz54-2aru/rows.csv?accessType=DOWNLOAD"
download.file(fileUrl, destfile = "./data/cameras.csv",method="curl")