usa_extract <- define_extract_micro(
collection = "usa",
description = "USA example",
samples = c("us2013a", "us2014a"),
variables = list(
var_spec("AGE", data_quality_flags = TRUE),
var_spec("SEX", case_selections = "1"),
"RACE"
)
)
# Providing names of samples or variables will remove them and
# all of their associated specifications from the extract:
remove_from_extract(
usa_extract,
samples = "us2014a",
variables = c("AGE", "RACE")
)
# To remove detailed specifications from a variable or time use variable,
# indicate the specifications to remove within `var_spec()` or
# `tu_var_spec()`. The named variable will be retained in the extract, but
# modified by removing the indicated specifications.
remove_from_extract(
usa_extract,
variables = var_spec("SEX", case_selections = "1")
)
# To make multiple modifications, use a list of `var_spec()` objects.
remove_from_extract(
usa_extract,
variables = list(
var_spec("SEX", case_selections = "1"),
var_spec("AGE")
)
)
Run the code above in your browser using DataLab