Download IPUMS extract using ipumsr::wait_for_extract and ipumsr::download_extract
Source: R/get_ipumsr_extract_paths.R
download_ipumsr_extract.Rddownload_ipumsr_extract() is a wrapper for ipumsr::wait_for_extract() and
ipumsr::download_extract() to wait until an extract is ready for download
before attempting to download it.
Usage
download_ipumsr_extract(
extract = NULL,
download_dir = getwd(),
overwrite = FALSE,
progress = TRUE,
...,
api_key = Sys.getenv("IPUMS_API_KEY")
)Arguments
- extract
One of:
An
ipums_extractobjectThe data collection and extract number formatted as a string of the form
"collection:number"or as a vector of the formc("collection", number)An extract number to be associated with your default IPUMS collection. See
set_ipums_default_collection()
For a list of codes used to refer to each collection, see
ipums_data_collections().- download_dir
Path to the directory where the files should be written. Defaults to current working directory.
- overwrite
If
TRUE, overwrite files with the same name that already exist indownload_dir. Defaults toFALSE.- progress
If
TRUE, output progress bar showing the status of the download request. Defaults toTRUE.- ...
Arguments passed on to
ipumsr::wait_for_extractinitial_delay_secondsSeconds to wait before first status check. The wait time will automatically increase by 10 seconds between each successive check.
max_delay_secondsMaximum interval to wait between status checks. When the wait interval reaches this value, checks will continue to occur at
max_delay_secondsintervals until the extract is complete ortimeout_secondsis reached. Defaults to 300 seconds (5 minutes).timeout_secondsMaximum total number of seconds to continue waiting for the extract before throwing an error. Defaults to 10,800 seconds (3 hours).
verboseIf
TRUE, print status updates to the R console at the beginning of each wait interval and upon extract completion. Defaults toTRUE.
- api_key
API key associated with your user account. Defaults to the value of the
IPUMS_API_KEYenvironment variable. Seeset_ipums_api_key().