Reputation: 2211
I am trying to download Kaggle data files directly in R:
download.file("http://www.kaggle.com/c/walmart-recruiting-store-sales-forecasting/download/train.csv.zip", "/train.csv.zip")
Error in download.file("http://www.kaggle.com/c/walmart-recruiting-store-sales-forecasting/download/train.csv.zip", :
cannot open destfile '/train.csv.zip', reason 'Permission denied'
Any known walk arounds?
Upvotes: 1
Views: 2156
Reputation: 99371
Your destfile
is incorrect. destfile
is the destination for the downloaded file (on your computer). I usually use a tempfile
to create a temporary file as a destination for the download, and then unlink
it later.
tmp <- tempfile()
url <- "http://www.kaggle.com/c/walmart-recruiting-store-sales-forecasting/download/train.csv.zip"
download.file(url, destfile = tmp)
Then check list.files('tmp')
(depending on where tmp
is on your computer), unzip
it, read it, and use unlink(tmp)
to dump it once you've read it into R.
Upvotes: 3