Learn R Programming

etl (version 0.4.1)

smart_download: Download only those files that don't already exist

Description

Download only those files that don't already exist

Usage

smart_download(obj, src, new_filenames = basename(src), clobber = FALSE, ...)

Arguments

obj

an etl object

src

a character vector of URLs that you want to download

new_filenames

an optional character vector of filenames for the new (local) files. Defaults to having the same filenames as those in src.

clobber

do you want to clobber any existing files?

...

arguments passed to download

Author

idiom courtesy of Hadley Wickham

Details

Downloads only those files in src that are not already present in the directory specified by the raw_dir attribute of obj.

Examples

Run this code
if (FALSE) {
cars <- etl("mtcars")
urls <- c("https://raw.githubusercontent.com/beanumber/etl/master/etl.Rproj",
"https://www.reddit.com/robots.txt")
smart_download(cars, src = urls)
# won't download again if the files are already there
smart_download(cars, src = urls)
# use clobber to overwrite
smart_download(cars, src = urls, clobber = TRUE)
}

Run the code above in your browser using DataLab