cachaca | R Documentation |
check remote file size. check cache for a match and if it exists, copy it over. otherwise, download the file, confirm file size, save to cache too
cachaca(this_url, destfile = NULL, ..., FUN = download.file, attempts = 3,
sleepsec = 60, filesize_fun = "httr",
savecache = getOption("lodown.cachaca.savecache", TRUE),
cdc_ftp_https = TRUE)
this_url |
where to download from |
destfile |
where to save locally, unnecessary when returning an object with |
... |
passed to FUN |
FUN |
defaults to |
attempts |
number of times to retry a broken download |
sleepsec |
length of |
filesize_fun |
use |
savecache |
whether to actually cache the downloaded files in the temporary directories. setting this option to FALSE eliminates the purpose of cachaca(), but sometimes it's necessary to disable for a single call, or globally. |
cdc_ftp_https |
whether to substitute cdc ftp sites with https, i.e. |
just pass on whatever FUN returns
## Not run:
# only the first of these two lines downloads the file. the second line uses the cached file
tf <- tempfile()
cachaca( "https://www.r-project.org/logo/Rlogo.png" , tf , mode = 'wb' )
cachaca( "https://www.r-project.org/logo/Rlogo.png" , tf , mode = 'wb' )
# option to disable cache in case the files are too big
options( "lodown.cachaca.savecache" = FALSE )
cachaca( "https://www.r-project.org/logo/Rlogo.svg" , tf , mode = 'wb' )
cachaca( "https://www.r-project.org/logo/Rlogo.svg" , tf , mode = 'wb' )
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.