[R-pkg-devel] download.file and https
Dirk Eddelbuettel
edd at debian.org
Fri Jul 3 12:39:59 CEST 2015
In random, I do the following, using R 3.2.0 or later with libcurl where
installed, and Jeroen's lightweight curl::curl otherwise.
getConnection <- function(urltxt, ...) {
if (getRversion() >= "3.2.0" && capabilities()["libcurl"]) {
url(urltxt, ..., method="libcurl")
} else {
curl(urltxt, ...)
}
}
closeConnection <- function(con) {
if (getRversion() >= "3.2.0" && capabilities()["libcurl"]) {
close(con)
} else {
## nothing to be done for curl()
}
}
Hth, Dirk
--
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
More information about the R-package-devel
mailing list