- dataset
A required string that sets the name of the data set of interest (e.g. "acs/acs5").
Descriptions/vintages for datasets can be found by running
RcensusPkg::get_dataset_names().
- vintage
An optional numeric that sets the vintage of interest. Available vintages
for a specific dataset can be found by running RcensusPkg::get_dataset_names().
- vars
A required string vector (if the parameter 'group' is NULL) of variable names to be acquired.
Available variable names can be determined by running RcensusPkg::get_variable_names().
- NAME_GEOID
A logical which if TRUE will add "NAME" and "GEO_ID" variables to the 'vars' string vector.
The default is TRUE.
- predicates
An optional vector of strings that adds data filtering.
See Census Data API User Guide for
forming predicates and filtering or limiting variables. As noted in the guide each predicate must
start with an ampersand sign.
- group
An optional string that names an entire group of similar variables to be retrieved.
For example the group value "B01001" would return values of all variables related to
"SEX BY AGE". To find available groups submit a dataset and vintage to RcensusPkg::get_groups.
- wide_to_long
If 'group' is defined then the returned data.table is normally in a wide format with all the group variables as columns.
If this logical parameter is TRUE then a long format is returned with group variable names in one column (named "estimate") and
their respective values in another column (named "value").
- region
An optional string that specifies the geography of the request. See
Federal Information Processing Series (FIPS)
for a listing of codes for this and the 'regionin' parameter. Not all regions such as counties,
blocks, or tracts are available for a specific dataset and vintage. Use
RcensusPkg::get_geography() to check on both 'region' and 'regionin'.
- regionin
An optional string that sets a qualifier for 'region'.
- na_cols
If TRUE will remove all rows with missing values. If a
vector of column names/integers will check only those columns for missing values.
- key
A required string that sets the access key. All Census Bureau API requests require an access key.
Sign-up for a key is free and can be obtained here.
The function will check for a global setting of the key via Sys.getenv("CENSUS_KEY").
Run usethis::edit_r_environ() and edit your .Renviron file with the line: CENSUS_KEY=your key
to create the global association.