save_extract_as_json: Save an extract definition to disk as JSON

View source: R/api.R

save_extract_as_jsonR Documentation

Save an extract definition to disk as JSON

Description

Save an extract definition to a JSON-formatted file. For an overview of ipumsr API functionality, see vignette("ipums-api", package = "ipumsr").

Usage

save_extract_as_json(extract, file)

Arguments

extract

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

file

File path at which to write the JSON-formatted extract definition.

Details

Note that this function only saves out the properties of an extract that are required to submit a new extract request, namely, the description, data structure, data format, samples, and variables.

Value

The file path where the extract definition was written, invisibly.

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(), submit_extract(), wait_for_extract()

Examples

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

extract_json_path <- file.path(tempdir(), "usa_extract.json")
save_extract_as_json(my_extract, file = extract_json_path)

copy_of_my_extract <- define_extract_from_json(extract_json_path, "usa")

identical(my_extract, copy_of_my_extract)


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