[R-SIG-Mac] download.file suggestion: if(OSX){ use curl}
Timothy Bates
timothy.c.bates at gmail.com
Thu Jul 7 16:33:11 CEST 2011
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
> url and file support URL schemes http://, ftp:// and file://.
and
> Note that \samp{https://} connections are
> #ifdef unix
> not supported (with some exceptions on Windows).
> #endif
>
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:
> On Jul 4, 2011, at 7:38 AM, Timothy Bates wrote:
>> Currently download.file() doesn’t handle https (or anything secure)
>> I wonder if the download.file() function could be special cased for platforms that have curl on board and use that?
> It already supports curl so why should it special-case anything? If you want to use curl by default (I don't for example) just set the download.file.method option.
> Cheers, Simon
More information about the R-SIG-Mac
mailing list