Tidy Census with mods
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R
data-raw
data
docs
examples
man
vignettes
.Rbuildignore
.gitignore
.travis.yml
DESCRIPTION
LICENSE
NAMESPACE
README.md
_pkgdown.yml
index.Rmd
tidycensus.Rproj

README.md

tidycensus

Build Status CRAN Badge CRAN Downloads

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")

In version 0.3.1:

  • Error fixed due to duplicated county polygons in the 1990 and 2000 Census geometries

New in version 0.3:

  • Get an entire table of decennial Census or ACS data by supplying the table name. For example, to get the entire ACS table B01001 from the 2016 1-year ACS (assuming here that you've already installed your Census API key with census_api_key("KEY", install = TRUE):
library(tidycensus)

df <- get_acs(geography = "state", table = "B01001", survey = "acs1", year = 2016)

The table parameter fetches a variable list from the Census Bureau website to perform table lookup. To cache the variable list on your computer for faster use of the table parameter in the future, set cache_table = TRUE the first time you fetch a table for a particular dataset.

Why tidycensus?

My work heavily involves the use of data from the US Census Bureau, and like many R users, I do most of my work within the tidyverse. Beyond this, the sf package now allows R users to work with spatial data in an integrated way with tidyverse tools, and updates to the tigris package provide access to Census boundary data as sf objects. Recently, I've found myself writing the same routines over and over to get Census data ready for use with tidyverse packages and sf. This motivated me to wrap these functions in a package and open-source in case other R users find them useful.

tidycensus is designed to help R users get Census data that is pre-prepared for exploration within the tidyverse, and optionally spatially with sf. To learn more about how the package works, I encourage you to read the following articles:

Future development

To keep up with on-going development of tidycensus and get even more examples of how to use the package, subscribe to my email list by clicking here (no spam, I promise!). You'll also get updates on the development of my upcoming book with CRC Press, Analyzing the US Census with R.

You can also follow my blog at https://walkerke.github.io.

My development focus is on making the current datasets as accessible as possible; if you need other approaches or datasets, I recommend the censusapi and acs packages.

If you find this project useful, you can support package development in the following ways:

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