downloadAndSaveRDS: Download a ZIP file, extract, and save the data as an RDS...

Description Usage Arguments Value

View source: R/downloadAndSaveRDS.R

Description

This is a utility function that will download a zip file and extract the data.

Usage

1
2
3
4
5
6
7
8
9
downloadAndSaveRDS(
  url,
  filename = tools::file_path_sans_ext(basename(url)),
  download.dir = "data-raw/",
  out.dir = "data/",
  filetypes = c("mdb", "aacdb", "csv"),
  redownload = FALSE,
  cleanup = FALSE
)

Arguments

url

the url of the ZIP file containing the data.

filename

the name of the RDS file to write (excluding file extension).

download.dir

directory to download the ZIP file.

out.dir

directory to write the RDS file.

filetypes

file extensions to look for in the ZIP file to convert to RDS.

redownload

whether to redownload the ZIP file.

cleanup

delete the downloaded ZIP file if the RDS file was created successfully.

Value

the data object read. This would be a data frame (for CSV files) or a list (for MDB and AACDB files).


jbryer/NYEdData documentation built on Dec. 20, 2021, 10:02 p.m.