remove_from_extract: Remove values from an IPUMS USA or CPS extract

View source: R/api.R

remove_from_extractR Documentation

Remove values from an IPUMS USA or CPS extract

Description

Remove existing values from fields of an IPUMS USA or CPS extract object. All fields are optional, and if omitted, will remain unchanged.

To add new values to an extract, see add_to_extract().

For an overview of ipumsr microdata API functionality, see vignette("ipums-api", package = "ipumsr").

Usage

remove_from_extract(extract, ...)

## S3 method for class 'usa_extract'
remove_from_extract(
  extract,
  samples = NULL,
  variables = NULL,
  validate = TRUE,
  ...
)

## S3 method for class 'cps_extract'
remove_from_extract(
  extract,
  samples = NULL,
  variables = NULL,
  validate = TRUE,
  ...
)

Arguments

extract

An ipums_extract object.

...

Further arguments passed to methods.

samples

Character vector of samples to remove from the extract, if any.

variables

Character vector of variables to remove from the extract, if any.

validate

Logical value indicating whether to check the modified extract structure for validity. Defaults to TRUE.

Value

A modified IPUMS USA or CPS extract object

Note

If the supplied extract definition comes from a previously submitted extract, this function will reset the definition to an unsubmitted state.

See Also

Other ipums_api: add_to_extract(), define_extract_cps(), define_extract_from_json(), define_extract_usa(), 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(), save_extract_as_json(), set_ipums_api_key(), submit_extract(), wait_for_extract()

Examples

usa_extract <- define_extract_usa(
  description = "USA example",
  samples = c("us2013a", "us2014a"),
  variables = "YEAR"
)

revised_usa_extract <- remove_from_extract(
  usa_extract,
  samples = "us2014a"
)

revised_usa_extract


cps_extract <- define_extract_cps(
  description = "CPS example",
  samples = c("cps2019_03s", "cps2020_03s"),
  variables = "YEAR"
)

revised_cps_extract <- remove_from_extract(
  cps_extract,
  samples = "cps2020_03s"
)

revised_cps_extract

ipumsr documentation built on Sept. 30, 2022, 9:05 a.m.