Define an extract request object to be submitted via the IPUMS API. For an overview of ipumsr API functionality, see vignette("ipums-api", package = "ipumsr").

define_extract(
  collection,
  description,
  samples,
  variables,
  data_format = c("fixed_width", "csv", "stata", "spss", "sas9"),
  data_structure = "rectangular",
  rectangular_on = "P"
)

Arguments

collection

The IPUMS data collection for the extract.

description

Description of the extract.

samples

Character vector of samples to include in the extract. Samples should be specified using the Sample ID values.

variables

Character vector of variables to include in the extract.

data_format

The desired format of the extract data file (one of "fixed_width", "csv", "stata", "spss", or "sas9").

data_structure

Currently, this must be "rectangular", which is also the default. In the future, the API will also support "hierarchical" extracts.

rectangular_on

Currently, this must be "P", indicating that the extract will be rectangularized on person records. In the future, the API will also support household-only extracts (rectangular_on = "H").

Value

An object of class ipums_extract containing the extract definition.

See also

Examples

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