我无法使用download.file
下载文件。
我的代码:
setwd("C:/Users/James/Documents/coursera/course 3/w1"
if(!file.exists("data")) {
dir.create("data")
}
fileUrl <- "https://data.baltimorecity.gov/api/views/dz54-2aru/rows.csv?accessType=DOWNLOAD"
download.file(fileUrl, ".data/caeras.csv", method="curl")
list.files("./data")
我收到以下错误:
download.file(fileUrl,“。data / caeras.csv”,method =“curl”)出错:
'curl'调用具有非零退出状态
另外:警告信息:
运行命令'curl“https://data.baltimorecity.gov/api/views/dz54-2aru/rows.csv?accessType=DOWNLOAD” - o“.data / caeras.csv”'状态23
(注意:文件位置有效,目录就在那里。)
为什么文件没有下载?
答案 0 :(得分:0)
该代码工作正常,检查您的浏览器设置,我只需单击该链接并下载该文件:部分内容如下:
ddress,direction,street,crossStreet,intersection,Location 1 S CATON AVE&amp; BENSON AVE,N / B,Caton Ave,Benson Ave,Caton Ave&amp; Benson Ave,&#34;(39.2693779962,-76.6688185297)&#34; S CATON AVE&amp; BENSON AVE,S / B,Caton Ave,Benson Ave,Caton Ave&amp; Benson Ave,&#34;(39.2693157898,-76.6689698176)&#34; 威尔肯大道&amp; PINE HEIGHTS AVE,E / B,Wilkens Ave,Pine Heights,Wilkens Ave&amp; Pine Heights,&#34;(39.2720252302,-76.676960806)&#34; ALAMEDA&amp; E 33RD ST,S / B,Alameda,33rd St,The Alameda&amp;第33街,&#34;(39.3285013141,-76.5953545714)&#34; E 33RD ST&amp; ALAMEDA,E / B,E 33rd,Alameda,E 33rd&amp;阿拉米达,&#34;(39.3283410623,-76.5953594625)&#34; ERDMAN AVE&amp; N MACON ST,E / B,Erdman,Macon St,Erdman&amp; Macon St,&#34;(39.3068045671,-76.5593167803)&#34; ERDMAN AVE&amp; N MACON ST,W / B,Erdman,Macon St,Erdman&amp; Macon St,&#34;(39.306966535,-76.5593122365)&#34; N CHARLES ST&amp; E LAKE AVE,S / B,Charles,Lake Ave,Charles&amp; Lake Ave,&#34;(39.3690535299,-76.625826716)&#34; E MADISON ST&amp; N CAROLINE ST,W / B,Madison,Caroline St,Madison&amp; Caroline St,&#34;(39.2993257666,-76.5976760827)&#34; ORLEANS ST&amp; N LINWOOD AVE,E / B,Orleans,Linwood Ave,Orleans&amp; Linwood Ave,&#34;(39.2958661981,-76.5764270078)&#34; EASTERN AVE&amp; KANE ST,E / B,Eastern,Kane St,Eastern&amp; Kane St,&#34;(39.2877626582,-76.5371017795)&#34; EDMONDSON AVE&amp; COOKS LN,E / B,Edmonson,Cooks Lane,Edmonson&amp; Cooks Lane,&#34;(39.2923680595,-76.7017056326)&#34; W FRANKLIN ST&amp; N PULASKI ST,W / B,Franklin,Pulaski St,Franklin&amp; Pulaski St,&#34;(39.2937082594,-76.6503837515)&#34; ORLEANS ST&amp; N GAY ST,E / B,Orleans,Gay St,Orleans&amp; Gay St,&#34;(39.2947203114,-76.606128007)&#34; S MARTIN LUTHER KING JR BLVD&amp; WASHINGTON BLVD,N / B,MLK Jr. Blvd.,Washington Blvd,MLK Jr. Blvd. &安培; Washington Blvd,&#34;(39.2834598231,-76.6261138807)&#34; HILLEN RD&amp; ARGONNE DR,S / B,Hillen Rd,Argonne Drive,Hillen Rd&amp; Argonne Drive,&#34;(39.3399907644,-76.588021025)&#34; W NORTH AVE&amp; N HOWARD ST,W / B,North Ave,Howard St,North Ave&amp; Howard St,&#34;(39.3110873669,-76.6193071428)&#34; E PATAPSCO AVE&amp;第4 ST,W / B,&#34; P