View source: R/download_images.R
download_images | R Documentation |
download_images
takes a data frame or a vector of URLs and downloads
the files to a local folder, possibly with the use of an additional ID vector
to rename the files and check for duplicates.
download_images(
x = NULL,
destination,
path = photos,
id = id,
check_duplicates = TRUE,
quiet = FALSE
)
x |
A data frame with a column containing URLs to be downloaded and
IDs to be linked to the downloads for file naming and duplicate detection.
If x is supplied, the |
destination |
A character scalar indicating a local folder where images should be downloaded to. |
path |
If x is supplied, the name of a list or character field in x with URLs to be downloaded. If x is NULL, a list or character vector of URLs. In either case, elements should begin with "http", "https", "ftp" or "ftps". If the URL has no extension, it will be given the extension ".jpg". |
id |
If x is supplied, the name of a character field (or field which can
be coerced to a character field) in x with IDs to match to the file
downloads. If x is NULL, a character vector (or vector which can be coerced
to a character vector) the same length as |
check_duplicates |
A logical scalar (default TRUE) indicating whether to
skip downloads for files whose IDs match files already present in the
download folder. This check is done per ID rather than per file, which means
that if any files with an ID of |
quiet |
A logical scalar. Should the function execute quietly, or should it return status updates throughout the function (default)? |
Invisibly, a data frame summarizing the results of the downloads.
## Not run:
# Setup
df <- data.frame(id = 1:15, photos = example_urls)
dest <- tempdir()
download_images(df, dest)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.