Skip to contents

Key functions and data tables

you will call these to get American Community Survey data

Getting data from the API

These functions deal with technical aspects of accessing the Census API

fetch_data()
Download a set of data from the US Census API
fetch_decennial_pops_by_race()
Get decennial census estimates of per-block populations by race/ethnicity

The contents of the API

These functions and tables will help you to look up information about which Census tables store which information.

search_in_columns()
Search for terms in a glossary in case-insensitive ways
unpack_group_details()
Pull apart the lists of details for one group of ACS data
METADATA_FOR_ACS_GROUPS
Details about the groups in the most recent American Community Series
METADATA_FOR_ACS_VARIABLES
Details about variables in the most recent American Community Series
METADATA_FOR_ACS_GEOGRAPHIES
Details about levels of geographic detail in the most recent American Community Series
DECENNIAL_POPULATION_FIELDS
Variables from the Decennial censuses
GEOGRAPHY_HIERARCHY_METADATA
Geographic levels of organization for data from the US Census Bureau's API
RACE_ETHNICITY_SUBTABLES
Race and ethnicity codes and labels used by the U.S. Census Bureau

Useful descriptions of what is available

These tables connect real-world meanings to the table-name-row-number codes that you need to pull data from the Census API.

GLOSSARY_OF_AGE_AND_SEX
The fundamental demographics of age and sex from table B01001

Families

GLOSSARY_OF_CHILDREN_IN_POVERTY
Categorize ACS variables about children living in poverty and parents' birth origins
GLOSSARY_OF_CHILDREN_PER_FAMILY
Categorize ACS variables about children per family
GLOSSARY_OF_FAMILIES_WITH_CHILDREN
Categorize ACS variables counting families by number of children

Education

EDUCATIONAL_ATTAINMENT_LEVELS
Census labels for different levels of educational achievement
GLOSSARY_OF_EDUCATIONAL_ATTAINMENT
Census variables for different levels of educational achievement

Sustainable Income

GLOSSARY_OF_EMPLOYMENT_STATUS
Factor values associated with specific rows within employment-related ACS tables
GLOSSARY_OF_STANDARD_OF_LIVING
Categorize ACS variables about income : poverty level ratios by family sustainability

Utilities

Functions that a typical user won’t need to bother with, but might be useful for someone working to extend the capabilities of the package.

Constructing API calls

These functions deal with technical aspects of accessing the Census API

build_api_variable()
Vectorized Creation of Census ACS Variables
build_api_url()
Create an API call to send to api.census.gov

Codes and data structures in the API

Glossary about abbreviations, codes, and other arcane shorthand that appear in the Census API.

TYPES_OF_TABLE
A Census table's ID always starts with an alphanumeric code for its type.
TYPES_OF_SUBJECT
A code for the broad subject that a Census table covers.
TYPES_OF_RACE_OR_ETHNICITY
For selected tables, an alphabetic suffix follows to indicate that a table is repeated for the nine major race and Hispanic or Latino groups:
TYPES_OF_VARIABLE
ACS data contain variables ending in 1- or 2-letter codes.

API key

These functions manage a key that the Census API uses to keep track of users.

api_key_is_set()
Check if the local environment contains an expected constant defining an API key
api_key_setup()
Guide a new user at setting up a Census API key
api_key_value()
Get the current value of the local Census API key

Miscellaneous

Other functions, usually legacy ones, that might help with things

subtract_parts_from_whole()
Computes a remainder values from measures of some subgroups and one all-group
the_year_right_now()
Today's year in the Gregorian calendar.

Keeping the glossaries up-to-date

Functions for updating the glossary tables, generally functions that only the package maintainers should run when the Census updates the ACS. The logic of these functions might be helpful to someone who is looking to better understand how the API works, though.

build_info_url()
Get the URL for JSON glossary about one table of ACS data
most_recent_vintage()
Query the Census API for the most recent release year of a dataset.
latest_acs_metadata()
Download glossary about the most recent versions of the 1- and 5-year ACS
fetch_metadata_table()
Fetch glossary about a specific ACS data set from the Census API.
hoist_table_glossary()
Hoist details about a Census data group from a list of strings to separate columns