I am trying to download a file in R 3.0.1 (Windows 7):
fileUrl <- "https://data.baltimorecity.gov/api/views/dz54-2aru/rows.csv?accessType=DOWNLOAD"
download.file(fileUrl, destfile="./data/cameras.csv", method="curl")
I checked both the url and my internet connection and they seem to be working just fine. However, I get this message:
Warning message:
In download.file(fileUrl, destfile = "./data/cameras.csv", method = "curl") :
download had nonzero exit status
Can't find any help online, anybody knows how to fix this?
A non-zero exit status indicates failure. This seemingly counter-intuitive scheme is used so there is one well-defined way to indicate success and a variety of ways to indicate various failure modes. When a command terminates on a fatal signal whose number is N , Bash uses the value 128+ N as the exit status.
The answer by @dickoa probably works, but I think the major issue is that you are using https
unnecessarily. I think this works:
# Note the http instead of https
file<-'http://data.baltimorecity.gov/api/views/dz54-2aru/rows.csv?accessType=DOWNLOAD'
read.csv(file)
Still don't understand why removing method = "curl"
don't solve the problem.
Another solution is install the downloader
package which wrap download.file
and make the download process easier and cross-platform (one function with same paramters for all OS)
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")
Hope that it will work this time
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With