[Rd] Suggesting to have download.file() reflect a new option
Dirk Eddelbuettel
edd@debian.org
Sun, 4 Nov 2001 09:44:47 -0600
The "auto" method of downloading a file cannot cope with a proxy firewall
requiring authentication. However, wget can handle this very easily (using
e.g. ~/.wgetrc). While it is feasible to add the required
method="wget"
to calls such as update.packages(), this approach is rather tedious and could
easily be controlled by use of a new option.
Below is a simple patch to download.file.R which, when no method is
specified, queries the (suggested) option download.file.method and sets it if
found; else the old default "auto" is used. The same patch can be applied to
windows/download.file.R. I'd be happy to add a small patch to the
documentation of both download.file() and options() to complement this is the
patch is deemed acceptable.
Regards, Dirk
edd@sonny:~/debian/r-base-1.3.1> diff -u src/library/base/R/unix/download.file.R{.orig,}
--- src/library/base/R/unix/download.file.R.orig Fri Apr 13 02:50:27 2001+++ src/library/base/R/unix/download.file.R Sun Nov 4 09:27:47 2001
@@ -1,9 +1,12 @@
download.file <- function(url, destfile, method,
quiet = FALSE, mode = "w")
{
- method <- if(missing(method)) "auto" else
- match.arg(method,
- c("auto", "internal", "wget", "lynx", "socket"))
+ method <- if (missing(method))
+ ifelse(!is.null(getOption("download.file.method")),
+ getOption("download.file.method"),
+ "auto")
+ else
+ match.arg(method, c("auto", "internal", "wget", "lynx", "socket"))
if(method == "auto") {
if(capabilities("http/ftp"))
--
Better to have an approximate answer to the right question
than a precise answer to the wrong question. -- John Tukey
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._