R/wget.R

Defines functions wget

Documented in wget

#' wget download a file from internet and save it locally
#' @title Download a file from internet and save it locally
#' @author Marc Girondot
#' @return Nothing
#' @param url The url where to download file
#' @param ... The parameters send to download.file()
#' @description Download a file from internet and save it locally. This function is a wrapper for
#' download.files() that keep the name identical and can get several files at once. It was written to simplify 
#' downloading of file. It doest not use the true wget function (https://www.gnu.org/software/wget/) which is 
#' much more complex but also powerful.
#' @examples
#' \dontrun{
#' library(HelpersMG)
#' # Save locally the files send in the parameter url
#' wget(c("https://cran.r-project.org/web/packages/HelpersMG/HelpersMG.pdf", 
#'          "https://cran.r-project.org/web/packages/embryogrowth/embryogrowth.pdf"))
#' }
#' @export


wget <- function(url=stop("At least one internet adress is required"), ...) {
  for (i in 1:length(url))
    do.call(download.file, modifyList(list(url=url[i], destfile=basename(url[i])), list(...)))
  }

Try the HelpersMG package in your browser

Any scripts or data that you put into this service are public.

HelpersMG documentation built on Oct. 5, 2023, 5:08 p.m.