var1 <- var_spec(
"SCHOOL",
case_selections = c("1", "2"),
data_quality_flags = TRUE
)
var2 <- var_spec(
"RACE",
case_selections = c("140", "150"),
case_selection_type = "detailed",
attached_characteristics = c("mother", "spouse")
)
# Use variable specifications in a microdata extract definition:
extract <- define_extract_micro(
collection = "usa",
description = "Example extract",
samples = "us2017b",
variables = list(var1, var2)
)
extract$variables$SCHOOL
extract$variables$RACE
# For IPUMS Time Use collections, use `tu_var_spec()` to include user-defined
# time use variables
my_time_use_variable <- tu_var_spec(
"MYTIMEUSEVAR",
owner = "example@example.com"
)
# IPUMS-defined time use variables can be included either as `tu_var_spec`
# objects or with just the variable name:
define_extract_micro(
collection = "atus",
description = "Requesting user- and IPUMS-defined time use variables",
samples = "at2007",
time_use_variables = list(
my_time_use_variable,
tu_var_spec("ACT_PCARE"),
"ACT_SOCIAL"
)
)
Run the code above in your browser using DataLab