[Rd] Suggesting to have download.file() reflect a new option
Prof Brian Ripley
ripley@stats.ox.ac.uk
Sun, 4 Nov 2001 15:48:25 +0000 (GMT)
Sounds very reasonable. Please send me a patch file.
Brian
On Sun, 4 Nov 2001, Dirk Eddelbuettel wrote:
>
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
--
Brian D. Ripley, ripley@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._