赞
踩
对应课程:Coursera Getting & Cleaning Data Week1 Downloading Files
download.file(url, destfile, method, quiet = FALSE, mode = "w",
cacheOK = TRUE,
extra = getOption("download.file.extra"))
其参数含义如下:
遇到的问题
在使用Download.file,具体代码为:
fileUrl<-"http://data.baltimorecity.gov/api/views/dz54-2aru/rows.csv?accessType=DOWNLOAD"
download.file(fileUrl,destfile = "./data/cameras.csv", method="crul")
list.files("./data")
报错:
Error in download.file(fileUrl, destfile = "./data/cameras.csv") :
cannot open destfile './data/cameras.csv', reason 'No such file or directory'
解决方法:
dir.create("data")
,下面两个方法是查到的,不对应本次问题。install.packages("downloader")
fileUrl <- "https://data.baltimorecity.gov/api/views/dz54-2aru
/rows.csv?accessType=DOWNLOAD"
require(downloader)
download(fileUrl, "data/cameras.csv", mode = "wb")
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。