Get information about a Census Bureau API dataset, including its available variables, geographies, variable groups, and value labels
Usage
listCensusMetadata(
name,
vintage = NULL,
type = "variables",
group = NULL,
variable_name = NULL,
include_values = FALSE
)
Arguments
- name
API programmatic name - e.g. acs/acs5. Use
listCensusApis()
to see valid dataset names.- vintage
Vintage (year) of dataset. Not required for timeseries APIs.
- type
Type of metadata to return. Options are:
"variables" (default) - list of variable names and descriptions for the dataset.
"geographies" - available geographies.
"groups" - available variable groups. Only available for some datasets.
"values" - encoded value labels for a given variable. Pair with "variable_name". Only available for some datasets.
- group
An optional variable group code, used to return metadata for a specific group of variables only. Variable groups are not used for all APIs.
- variable_name
A name of a specific variable used to return value labels for that variable. Value labels are not used for all APIs.
- include_values
Use with
type = "variables"
. Include value metadata for all variables in a dataset if value metadata exists. Default is "FALSE".
See also
Other metadata:
listCensusApis()
,
makeVarlist()
Examples
# type: variables # List the variables available in the Small Area
# Health Insurance Estimates.
variables <- listCensusMetadata(
name = "timeseries/healthins/sahie", type = "variables")
head(variables)
#> name
#> 1 for
#> 2 in
#> 3 time
#> 4 NIPR_LB90
#> 5 NIPR_PT
#> 6 AGECAT
#> label
#> 1 Census API FIPS 'for' clause
#> 2 Census API FIPS 'in' clause
#> 3 ISO-8601 Date/Time value
#> 4 Number in Demographic Group for Selected Income Range, Upper Bound for 90% Confidence Interval
#> 5 Number in Demographic Group for Selected Income Range, Estimate
#> 6 Age Category
#> concept predicateType group limit predicateOnly
#> 1 Census API Geography Specification fips-for N/A 0 TRUE
#> 2 Census API Geography Specification fips-in N/A 0 TRUE
#> 3 Census API Date/Time Specification datetime N/A 0 TRUE
#> 4 <NA> int N/A 0 <NA>
#> 5 <NA> int N/A 0 <NA>
#> 6 <NA> string N/A 0 <NA>
#> required
#> 1 <NA>
#> 2 <NA>
#> 3 true
#> 4 <NA>
#> 5 <NA>
#> 6 default displayed
# type: variables for a single variable group
# List the variables that are included in the B17020 group in the
# 5-year American Community Survey.
variable_group <- listCensusMetadata(
name = "acs/acs5", vintage = 2022,
type = "variables", group = "B17020")
head(variable_group)
#> name
#> 1 B17020_017EA
#> 2 B17020_016MA
#> 3 B17020_016EA
#> 4 B17020_015MA
#> 5 B17020_015EA
#> 6 B17020_014EA
#> label
#> 1 Annotation of Estimate!!Total:!!Income in the past 12 months at or above poverty level:!!85 years and over
#> 2 Annotation of Margin of Error!!Total:!!Income in the past 12 months at or above poverty level:!!75 to 84 years
#> 3 Annotation of Estimate!!Total:!!Income in the past 12 months at or above poverty level:!!75 to 84 years
#> 4 Annotation of Margin of Error!!Total:!!Income in the past 12 months at or above poverty level:!!60 to 74 years
#> 5 Annotation of Estimate!!Total:!!Income in the past 12 months at or above poverty level:!!60 to 74 years
#> 6 Annotation of Estimate!!Total:!!Income in the past 12 months at or above poverty level:!!18 to 59 years
#> concept predicateType group limit
#> 1 Poverty Status in the Past 12 Months by Age string B17020 0
#> 2 Poverty Status in the Past 12 Months by Age string B17020 0
#> 3 Poverty Status in the Past 12 Months by Age string B17020 0
#> 4 Poverty Status in the Past 12 Months by Age string B17020 0
#> 5 Poverty Status in the Past 12 Months by Age string B17020 0
#> 6 Poverty Status in the Past 12 Months by Age string B17020 0
#> predicateOnly universe
#> 1 TRUE Population for whom poverty status is determined
#> 2 TRUE Population for whom poverty status is determined
#> 3 TRUE Population for whom poverty status is determined
#> 4 TRUE Population for whom poverty status is determined
#> 5 TRUE Population for whom poverty status is determined
#> 6 TRUE Population for whom poverty status is determined
# type: variables, with value labels
# Create a data dictionary with all variable names and encoded values
# for a microdata API.
variable_values <- listCensusMetadata(
name = "cps/voting/nov",
vintage = 2020,
type = "variables",
include_values = TRUE)
head(variable_values)
#> name label
#> 1 for Census API FIPS 'for' clause
#> 2 in Census API FIPS 'in' clause
#> 3 ucgid Uniform Census Geography Identifier clause
#> 4 PEEDUCA Demographics-highest level of school completed
#> 5 PEEDUCA Demographics-highest level of school completed
#> 6 PEEDUCA Demographics-highest level of school completed
#> concept predicateType group limit predicateOnly
#> 1 Census API Geography Specification fips-for N/A 0 TRUE
#> 2 Census API Geography Specification fips-in N/A 0 TRUE
#> 3 Census API Geography Specification ucgid N/A 0 TRUE
#> 4 <NA> int N/A 0 <NA>
#> 5 <NA> int N/A 0 <NA>
#> 6 <NA> int N/A 0 <NA>
#> suggested_weight is_weight values_code values_label
#> 1 <NA> <NA> <NA> <NA>
#> 2 <NA> <NA> <NA> <NA>
#> 3 <NA> <NA> <NA> <NA>
#> 4 PWSSWGT <NA> 46 DOCTORATE DEGREE(EX:PhD,EdD)
#> 5 PWSSWGT <NA> 33 5th Or 6th Grade
#> 6 PWSSWGT <NA> 44 MASTER'S DEGREE(EX:MA,MS,MEng,MEd,MSW)
# type: geographies
# List the geographies available in the 5-year American Community Survey.
geographies <- listCensusMetadata(
name = "acs/acs5",
vintage = 2022,
type = "geographies")
head(geographies)
#> name geoLevelDisplay referenceDate requires wildcard
#> 1 us 010 2022-01-01 NULL NULL
#> 2 region 020 2022-01-01 NULL NULL
#> 3 division 030 2022-01-01 NULL NULL
#> 4 state 040 2022-01-01 NULL NULL
#> 5 county 050 2022-01-01 state state
#> 6 county subdivision 060 2022-01-01 state, county county
#> optionalWithWCFor
#> 1 <NA>
#> 2 <NA>
#> 3 <NA>
#> 4 <NA>
#> 5 state
#> 6 county
# type: groups
# List the variable groups available in the 5-year American
# Community Survey.
groups <- listCensusMetadata(
name = "acs/acs5",
vintage = 2022,
type = "groups")
head(groups)
#> name
#> 1 B17015
#> 2 B18104
#> 3 B17016
#> 4 B18105
#> 5 B17017
#> 6 B18106
#> description
#> 1 Poverty Status in the Past 12 Months of Families by Family Type by Social Security Income by Supplemental Security Income (SSI) and Cash Public Assistance Income
#> 2 Sex by Age by Cognitive Difficulty
#> 3 Poverty Status in the Past 12 Months of Families by Family Type by Work Experience of Householder and Spouse
#> 4 Sex by Age by Ambulatory Difficulty
#> 5 Poverty Status in the Past 12 Months by Household Type by Age of Householder
#> 6 Sex by Age by Self-Care Difficulty
#> variables
#> 1 http://api.census.gov/data/2022/acs/acs5/groups/B17015.json
#> 2 http://api.census.gov/data/2022/acs/acs5/groups/B18104.json
#> 3 http://api.census.gov/data/2022/acs/acs5/groups/B17016.json
#> 4 http://api.census.gov/data/2022/acs/acs5/groups/B18105.json
#> 5 http://api.census.gov/data/2022/acs/acs5/groups/B17017.json
#> 6 http://api.census.gov/data/2022/acs/acs5/groups/B18106.json
#> universe
#> 1 Families
#> 2 Civilian noninstitutionalized population 5 years and over
#> 3 Families
#> 4 Civilian noninstitutionalized population 5 years and over
#> 5 Households
#> 6 Civilian noninstitutionalized population 5 years and over
# type: values for a single variable
# List the value labels of the NAICS2017 variable in the County
# Business Patterns dataset.
naics_values <- listCensusMetadata(
name = "cbp",
vintage = 2021,
type = "values",
variable = "NAICS2017")
head(naics_values)
#> code label
#> 1 00 Total for all sectors
#> 2 000000 Industry total
#> 3 11 Agriculture, forestry, fishing and hunting
#> 4 111 Crop production
#> 5 1111 Oilseed and grain farming
#> 6 11111 Soybean farming