roper_download: Download datasets from the Roper Center

View source: R/roper_download.R

roper_downloadR Documentation

Download datasets from the Roper Center

Description

roper_download provides a programmatic and reproducible means to download datasets from the Roper Center's data archive

Usage

roper_download(
  file_id,
  affiliation = getOption("roper_affiliation"),
  email = getOption("roper_email"),
  password = getOption("roper_password"),
  reset = FALSE,
  download_dir = "roper_data",
  msg = TRUE,
  convert = TRUE,
  delay = 2
)

Arguments

file_id

The unique identifier (or optionally a vector of these identifiers) for the dataset(s) to be downloaded (see details). Both new Archive Numbers and old Historical Archive Numbers, if the latter are available, may be used.

affiliation, email, password

Your Roper Center affiliation, email, and password (see details)

reset

If TRUE, you will be asked to re-enter your Roper Center affiliation, email, and password.

download_dir

The directory (relative to your working directory) to which files from the Roper Center will be downloaded.

msg

If TRUE, outputs a message showing which data set is being downloaded.

convert

If TRUE, converts downloaded file(s) to .RData format.

delay

If the speed of your connection to the Roper Center data archive is particularly slow, roper_download may encounter problems. Increasing the delay parameter may help.

Details

To avoid requiring others to edit your scripts to insert their own affiliation, email, and password or to force them to do so interactively, the default is set to fetch this information from the user's .Rprofile. Before running roper_download, then, you should be sure to add these options to your .Rprofile (usethis::edit_r_profile() is one particularly easy way), substituting your own info for the example below:

options("roper_affiliation" = "Upper Midwest University", "roper_email" = "juanita-herrara@uppermidwest.edu", "roper_password" = "password123!")

Value

The function returns nothing, but has the side effect of downloading all files of the datasets identified in the file_id argument.

Examples

## Not run: 
 roper_download(file_id = c("31117412", "USPEW2015-GOVERNANCE"),
                download_dir = tempdir()) # remember to specify a directory for your download

## End(Not run)


fsolt/ropercenter documentation built on July 5, 2023, 6:43 p.m.