Skip to contents

Downloads a file from a given URL and saves it to a specified destination.

Usage

download_data(url, destination)

Arguments

url

A character string specifying the file URL.

destination

A character string specifying the file path where the data will be saved.

Value

None. The function downloads the file as a side effect.

Examples

if (interactive()) {
  test_url <- paste0("https://raw.githubusercontent.com/rudeboybert/",
  "fivethirtyeight/master/data-raw/drug-use-by-age/drug-use-by-age.csv")
  test_dir <- "data/test"
  download_data(test_url, test_dir)
}