get_variable_names {RcensusPkg} | R Documentation |
get_variable_names
Description
Get Census Bureau variable acronym names and their label descriptions.
Function produces a data.table
of variable acronym names and their
descriptions. The function returns 4 columns:
name | the name of the parameter |
label | the Bureau's description of the parameter |
required | a boolean indicating if the parameter is required |
predicateType | a string indicating the variable primitive type |
Note that a variable with a required character value "true" must be included
in your data requests (i.e. RcensusPkg::get_vintage_data()
) or
the API will return an error.
Usage
get_variable_names(
dataset = NULL,
category = NULL,
vintage = 2020,
vars = NULL,
group = NULL,
filter_group_est = FALSE,
filter_name_str = NULL,
filter_label_str = NULL,
filter_concept_str = NULL,
ignore_case = TRUE,
fixed = FALSE
)
Arguments
dataset |
An optional string that sets the name of a dataset category of interest. | |||||||||||||||
category |
An optional string that sets the category of datasets. The available categories are one of the following:
| |||||||||||||||
vintage |
An required numeric that sets the year of interest. The default is 2020. | |||||||||||||||
vars |
An optional vector of variable names whose descriptions are of interest. This parameter requires that either 'dataset' or 'category' had been defined. | |||||||||||||||
group |
An optional string that sets the group name associated with a set of variables.
This parameter requires that either 'dataset' or 'category' had been defined.
See | |||||||||||||||
filter_group_est |
A logical which if | |||||||||||||||
filter_name_str |
A character string by which to filter the resultant | |||||||||||||||
filter_label_str |
A character string by which to filter the resultant | |||||||||||||||
filter_concept_str |
A character string by which to filter the resultant | |||||||||||||||
ignore_case |
A logical which if | |||||||||||||||
fixed |
A logical which if |
Details
The function's search for variable names depends on either specifying the parameters 'dataset'
name or a dataset 'category'. Entering an available 'vintage' also influences obtaining a
full dataframe of variable names and descriptions. To assist in using the function the user
should consult the Census Bureau's publicly available datasets descriptions.
Also of help is Rcensus::get_dataset_names()
for available dataset acronym names and
their available years.
Value
A data.table
Examples
# Get available variables that have the phrase "educational attainment"
# in "label" column of the resultant data.table.
library(data.table)
library(httr2)
library(RcensusPkg)
educational_attainment_2019_dt <- RcensusPkg::get_variable_names(
dataset = "acs/acs1/profile",
vintage = 2019,
filter_label_str = "educational attainment"
)