Learn R Programming

tidycensus

tidycensus is an R package that allows users to interface with the US Census Bureau's decennial Census and five-year American Community APIs and return tidyverse-ready data frames, optionally with simple feature geometry included. Install from CRAN with the following command:

install.packages("tidycensus")

For the latest updates, install from GitHub:

remotes::install_github("walkerke/tidycensus")

To learn more about the package, please visit the package documentation at https://walker-data.com/tidycensus/ or read the book Analyzing US Census Data: Methods, Maps, and Models in R at https://walker-data.com/census-r/.

Note: This product uses the Census Bureau Data API but is not endorsed or certified by the Census Bureau.

Copy Link

Version

Install

install.packages('tidycensus')

Monthly Downloads

9,502

Version

1.7.1

License

MIT + file LICENSE

Maintainer

Kyle Walker

Last Published

January 31st, 2025

Functions in tidycensus (1.7.1)

pums_variables

Dataset with PUMS variables and codes
interpolate_pw

Use population-weighted areal interpolation to transfer information from one set of shapes to another
moe_product

Calculate the margin of error for a derived product
moe_ratio

Calculate the margin of error for a derived ratio
moe_sum

Calculate the margin of error for a derived sum
to_survey

Convert a data frame returned by get_pums() to a survey object
significance

Evaluate whether the difference in two estimates is statistically significant.
get_pums

Load data from the American Community Survey Public Use Microdata Series API
summary_files

Identify summary files for a given decennial Census year
tidycensus-package

tidycensus: Load US Census Boundary and Attribute Data as 'tidyverse' and 'sf'-Ready Data Frames
state_laea

State geometry with Alaska and Hawaii shifted and re-scaled
check_ddhca_groups

Check to see if a given geography / population group combination is available in the Detailed DHC-A file.
get_acs

Obtain data and feature geometry for the American Community Survey
county_laea

County geometry with Alaska and Hawaii shifted and re-scaled
get_decennial

Obtain data and feature geometry for the decennial US Census
get_estimates

Get data from the US Census Bureau Population Estimates Program
census_api_key

Install a CENSUS API Key in Your .Renviron File for Repeated Use
get_flows

Obtain data and feature geometry for American Community Survey Migration Flows
as_dot_density

Convert polygon geometry to dots for dot-density mapping
moe_prop

Calculate the margin of error for a derived proportion
acs5_geography

Dataset used to identify geography availability in the 5-year ACS Detailed Tables
mig_recodes

Dataset with Migration Flows characteristic recodes
fips_codes

Dataset with FIPS codes for US states and counties
get_pop_groups

Get available population groups for a given Decennial Census year and summary file
load_variables

Load variables from a decennial Census or American Community Survey dataset to search in R