Skip to content
Prev 8152 / 15076 Next

download.file suggestion: if(OSX){ use curl}

Thanks Simon: that?s good news (if somewhat hidden?)

But?.
While this works

   secureURL = "https://dl.dropbox.com/s/pl60zb6cljootdj/test.txt?
   download.file(secureURL, "junk.txt", method=?curl?)

This doesn?t?
  
  read.table(secureURL)
  # Error in file(file, "rt") : cannot open the connection
  # In addition: Warning message:
  # In file(file, "rt") : unsupported URL scheme


The reason I thought that curl was explicitly not supported was the Rd help for <file> and <url> in ~/bin/R/trunk/src/library/base/man/connections.Rd
and
file() does not support this option, even if download.file() is told too.

If there is a way around this, or file and url can be changed, then I?m happy to submit Rd diffs or other help so people can find this valuable functionality at the  read.xxx level.

Something like 

url and file always support the http://, ftp:// and file:// URL schemes, and may support secure connections (https, sftp etc.).

#ifdef unix
  Secure connections (for instance https://) are supported via use of helpers such as curl which can be set via the <download.file.method> option of download.file.
#endif

With an example of how to do that. Thoughts welcome.
On 7 Jul 2011, at 2:33 PM, Simon Urbanek wrote: