submit_extract: Submit an extract request via the IPUMS API

View source: R/api.R

submit_extractR Documentation

Submit an extract request via the IPUMS API

Description

Given an extract definition object, submit an extract request via the IPUMS API, and return a modified copy of the extract object with the newly-assigned extract number. For an overview of ipumsr API functionality, see vignette("ipums-api", package = "ipumsr").

Usage

submit_extract(extract, api_key = Sys.getenv("IPUMS_API_KEY"))

Arguments

extract

An extract object created with define_extract_micro or returned from another ipumsr API function.

api_key

API key associated with your user account. Defaults to the value of environment variable "IPUMS_API_KEY".

Value

An object of class ipums_extract containing the extract definition and newly-assigned extract number of the submitted extract.

See Also

Other ipums_api: define_extract_from_json(), define_extract_micro(), download_extract(), extract_list_to_tbl(), extract_tbl_to_list(), get_extract_info(), get_last_extract_info(), get_recent_extracts_info, ipums_data_collections(), is_extract_ready(), revise_extract_micro(), save_extract_as_json(), wait_for_extract()

Examples

my_extract <- define_extract_micro("usa", "Example", "us2013a", "YEAR")

## Not run: 
# `submit_extract()` returns an ipums_extract object updated to include the
# extract number, so it is often useful to name the return object:
submitted_extract <- submit_extract(my_extract)

# If you didn't capture the return object of submit_extract for your most
# recent extract, you can recover that information with:
submitted_extract <- get_last_extract_info("usa")

# View the extract number
submitted_extract$number

# Check if submitted extract is ready
is_extract_ready(submitted_extract) # returns TRUE or FALSE

# Or have R check periodically until the extract is ready
downloadable_extract <- wait_for_extract(submitted_extract)

## End(Not run)


mnpopcenter/ipumsr documentation built on Sept. 30, 2022, 6:56 a.m.