Reputation: 9018
temp <- tempfile()
download.file("file://connect/me/test.gz",temp)
The url exists because I can put it in my browser but when I run that code I get the error:
Error in download.file("file://connect/me/test.gz", :
cannot open URL "file://connect/me/test.gz", reason 'No such file or directory'
any ideas how i can download the file and unzip it?
I found some info on fil:// here https://stat.ethz.ch/R-manual/R-devel/library/base/html/connections.html:
"A note on file:// URLs. The most general form (from RFC1738) is file://host/path/to/file, but R only accepts the form with an empty host field referring to the local machine."
"In this form the path is relative to the root of the filesystem, not a Windows concept. The standard form on Windows is file:///d:/R/repos: for compatibility with earlier versions of R and Unix versions, any other form is parsed as R as file:// plus path_to_file. Also, backslashes are accepted within the path even though RFC1738 does not allow them."
What does that mean?
ty
Upvotes: 3
Views: 7356
Reputation: 9018
I figured it out. I had to map a drive "B" to the folder and then
temp <- tempfile()
download.file("file:///B:/me/test.gz",temp,method="internal")
Upvotes: 2
Reputation: 3154
I think you need three slashes after file: and one slash for the rest. I tried this on windows 7 and it works fine.
temp <- tempfile()
download.file("file:///C:/Users/Philip/Desktop/Coursera/data/cameras.csv",temp)
Upvotes: 0