tidycensus: pulling US Census data into R data frames
Load US Census boundary and attribute data as 'tidyverse' and 'sf'-ready data frames in R
At a glance
- What is it?
- tidycensus is an R package that calls the US Census Bureau decennial Census and five-year American Community APIs and returns tidyverse-ready data frames, optionally with simple feature geometry attached. Its scope is narrow by design, and the parts of the API it does not cover are the parts you will have to read in the vignettes.
- Who is it for?
- Use tidycensus when your analysis needs Census tables as a plain data frame rather than a shapefile download, and when you are willing to register a free Census API key before the first call. Do not reach for it if you need a general purpose spatial data package, since the simple feature geometry is described as optional rather than the main event, and the last CRAN release listed is 1.4 from 2023-05-27 even though the last push was on 2026-10-19.
- Can I use it commercially?
- Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
- Is it still maintained?
- Yes. The repository last received commits 3 days ago.
- What is it written in?
- Mainly R, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on October 23, 2026, and from our analysis. They are not legal advice.
Editorial analysis
A thin wrapper whose value is the shape of the returned data
The US Census Bureau publishes its data through APIs, and the raw responses are not friendly to the R statistical workflow. tidycensus exists to sit between those endpoints and a data frame that behaves like any other tidyverse object. The package description says it lets users interface with the decennial Census and five-year American Community APIs and return tidyverse-ready data frames, optionally with simple feature geometry included.
Two design decisions follow from that description. The primary output is rectangular data, not a spatial object, so the geometry is an option rather than the default. And the package targets two specific API families, the decennial Census and the five-year American Community Survey, rather than attempting to cover every Census data product.
That focus is what makes it worth using. A researcher who needs a variable across counties and tracts does not have to think about API paths, geography identifiers or the difference between the two data programs at the HTTP level. The cost is that a question outside those two families is outside the package, and there is no indication in the documentation that a general query interface is planned.
A free API key is the first hurdle, and install is two commands
Everything in tidycensus depends on a Census API key, and the documentation is explicit that a free one is required. The key comes from a signup page at https://api.census.gov/data/key_signup.html, and the README shows it being registered from R with the `census_api_key` function:
library(tidycensus)
census_api_key("YOUR API KEY GOES HERE", install = TRUE)The `install = TRUE` argument is the part worth understanding. Without it the key lives only for the session; with it, the key is written to disk so later sessions find it without repeating the call. That is convenient, and it also means the credential is stored somewhere on the user's machine, which matters on shared or managed workstations.
Installing the package itself has two documented paths, one for the released version and one for the current development state:
install.packages("tidycensus")remotes::install_github("walkerke/tidycensus")The second pulls from GitHub rather than CRAN, which is the route to take if you need a change that has not reached the release channel.
What the repository structure tells you about the package
The layout is the standard R package skeleton, and reading it tells you where to look for behavior. `DESCRIPTION` holds the package metadata and dependencies, `NAMESPACE` lists the exported functions, and `R/` contains the implementation. `man/` holds the generated help pages that become the function reference.
The directories that are specific to this project are the interesting ones. `vignettes/` holds the longer-form articles, which in an R package are the usual place for worked examples that the reference pages cannot fit. `tests/` holds the test suite, and the README badge points at an R-CMD-check workflow, meaning the package is checked on a continuous integration service. `data-raw/` and `data/` are the conventional pair for scripts that generate shipped datasets and the datasets themselves.
Documentation infrastructure is also present. `pkgdown/` and `_pkgdown.yml` are the configuration for the reference site, and `docs/` is the rendered output, which is what the GitHub Pages site at https://walker-data.com/tidycensus serves.
`NEWS.md` and `cran-comments.md` sit at the top level as well. For a package whose most recent listed CRAN release is 1.4 from 2023-05-27, those two files are the fastest way to find out how much has changed since then, and whether the change log covers the same ground as the code.
Where the package is honest about its limits
The README carries a disclaimer that is easy to skip and worth reading carefully. It says the product uses the Census Bureau Data API but is not endorsed or certified by the Census Bureau. For a package that sits in the path between a user and a federal data service, that sentence sets expectations about who stands behind what.
The second honest limit is the scope of the data. Only the decennial Census and the five-year American Community APIs are named. The five-year program and the decennial program have different vintages, different table structures and different release schedules, and a package that covers both has to present them through one interface. Any claim about the shape of a returned data frame should be checked against the specific program and vintage in the vignettes, because the documentation covers the wrapper and the API reference covers the Census side, not the combination.
A third limit is the community, not the code. The package documentation and the accompanying book are hosted on a personal domain, walker-data.com, and the book is a separate purchase-driven publication. The package itself is open and the CRAN route is documented, so nothing about using it depends on that site, but the depth of guidance is tied to it.
CRAN releases versus a busy main branch
The release history is short. The listed releases are 1.4 and 1.0, both marked as CRAN releases, dated 2023-05-27 and 2021-05-21 respectively. There is no long tail of patch releases between them.
Against that, the repository is not archived and the last push was on 2026-10-19, which is recent. So the picture is a package whose published version has been stable for a long time while the source branch keeps moving. The `remotes::install_github` route exists precisely for people who want that moving branch rather than the last CRAN build.
That gap has a practical consequence for anyone planning a production pipeline. If you install from CRAN, you are running a build from 2023, and the question worth asking is whether the changes you want are in it. If you install from GitHub, you are tracking a branch that can change under you, and you take on the responsibility of pinning a commit if reproducibility matters to you.
The licence is reported as Other, a custom licence that GitHub cannot classify, and the repository carries a `LICENSE` file. That is the file to read before the package enters a workflow that redistributes data or ships code depending on it. Nothing here is legal advice, and the point is simply that the licence identifier is not one of the standard ones a policy checker will recognize.
tidycensus against a general spatial data workflow
The alternative approach to Census data in R is to download boundary and attribute files yourself, read them with a general spatial package, and do the geography joins by hand. The difference in approach is where the geography identifier handling and the table selection live.
In that workflow, the shape of the data and the request for the data are two separate operations that you combine yourself, and the joining of an attribute table to a boundary file is the step most likely to go wrong, because the identifiers are not the same strings in every product.
tidycensus collapses that. The description says it loads US Census boundary and attribute data as tidyverse and sf-ready data frames, and the optional simple feature geometry means the boundary and the attributes arrive in one object rather than two that you reconcile afterwards. The result is a data frame that carries its own geometry and still behaves like a tibble for the statistics step, which is the specific point of the tidyverse contract.
The trade-off is scope and control. A package built around the Census API returns what the API exposes for the parameters you give it, with the geography and variable identifiers resolved by the package. A manual workflow can pull any file the Census publishes, including products outside the two API families tidycensus targets. For the common case of a Census variable across a set of geographies, the API route removes most of the assembly work. For a niche product, it does not apply at all.
Editorial conclusion
Use tidycensus when your analysis needs Census tables as a plain data frame rather than a shapefile download, and when you are willing to register a free Census API key before the first call. Do not reach for it if you need a general purpose spatial data package, since the simple feature geometry is described as optional rather than the main event, and the last CRAN release listed is 1.4 from 2023-05-27 even though the last push was on 2026-10-19. Before you build a pipeline on it, check the function reference at https://walker-data.com/tidycensus for the table and variable arguments your own geography needs.
Frequently asked questions
How do I install tidycensus in R?
Use `install.packages("tidycensus")` for the CRAN version, or `remotes::install_github("walkerke/tidycensus")` for the current state of the source branch. The repository also links a package documentation site at https://walker-data.com/tidycensus.
Do I need a Census API key to use tidycensus?
Yes. A free key is required, and you obtain one at https://api.census.gov/data/key_signup.html. Register it in R with `census_api_key("YOUR API KEY GOES HERE", install = TRUE)`, where the `install` argument stores it for later sessions.
What data does tidycensus return?
It returns tidyverse-ready data frames from the US Census Bureau's decennial Census and five-year American Community APIs, with simple feature geometry included optionally. The package description also frames it as loading US Census boundary and attribute data as tidyverse and sf-ready data frames.
Is tidycensus endorsed by the US Census Bureau?
No. The README states that the product uses the Census Bureau Data API but is not endorsed or certified by the Census Bureau. The licence is also reported as a custom licence that GitHub cannot classify, with the terms in the LICENSE file.
Which version of tidycensus is current on CRAN?
The listed CRAN releases are 1.4 from 2023-05-27 and 1.0 from 2021-05-21. The repository is not archived and the last push was on 2026-10-19, so the source branch has moved on from the published build, and the GitHub install route is the way to track it.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/walkerke-tidycensus)Was this useful?