1

OS- Windows 7
R version 3.0.3
What I typed on R console :

if(!file.exists("data")){dir.create("data")}
fileUrl <- "https://data.baltimorecity.gov/api/views/dz54-2aru/rows.xlsx?accessType=DOWNLOAD"
download.file(fileUrl,destfile="./data/cameras.xlsx",method="curl")
dateDownloaded <- date()

What I got on R console

Warning messages:

1: running command 'curl  "https://data.baltimorecity.gov/api/views/dz54-2aru/rows.xlsx?accessType=DOWNLOAD"  -o "./data/cameras.xlsx"' had status 127 
2: In download.file(fileUrl, destfile = "./data/cameras.xlsx", method = "curl") :

download had nonzero exit status

How do I make it right ?

digEmAll
  • 56,430
  • 9
  • 115
  • 140
  • This is some 'interesting' formatting. Can you at least make the code formatted? FWIW, bold font doesn't make things more readable. – Roman Luštrik Sep 06 '14 at 11:46
  • Try RCurl as in here: http://stackoverflow.com/questions/23028760/download-csv-file-using-download-file-in-r – Jon Cardoso-Silva Sep 06 '14 at 12:02
  • change the `https` to just `http` and skip `method="curl"` in the `download.file`. This doesn't always work but that file is available via plain 'ol `http`. – hrbrmstr Sep 06 '14 at 14:47

2 Answers2

1

Your code works for me. You probably don't have cURL installed on your system. See ?download.file:

For methods "wget", "curl" and "lynx" a system call is made to the tool given by method, and the respective program must be installed on your system and be in the search path for executables.

Install cURL and make sure it is in your path.

CL.
  • 14,577
  • 5
  • 46
  • 73
0

After removing the method="curl" parameter, it works well on Windows.