Skip to Main Content

Digital Scholarship: R and RStudio

An introduction to the process of using R and additional resources for moving forward.

The Census API

The  U.S. Census Bureau maintains and API that allows researchers to programmatically access a wide range of data collected by the Census Bureau. This includes demographic, social, economic, and housing data from surveys like the Decennial Census, the American Community Survey (ACS), and the Population Estimates Program, among others. 

The API enables users to query large datasets without downloading full files, retrieve data for specific geographic areas such as states, counties, ZIP codes, or census tracts, automate data collection and analysis, and access time series or custom data tables. The API is free to use, though you need to request an API key to access it. YOu can request and API Key from the Census Bureau here:  https://api.census.gov/data/key_signup.html

In R, the tidycensus package provides a user-friendly way to interact with the Census API, wrapping API calls into simple functions that return tidy data frames ready for analysis, making it easy to quickly and iteratively retrieve and visualize Census data.

tidycensus

The free and complete ebook/website https://walker-data.com/tidycensus/ is the go-to guide for making the most of the rich datasets available through the Census Bureau using tidycensus in R.  It contains clear, step-by-step tutorials that guide users through installing the package, obtaining an API key, and making data requests. It covers practical examples such as pulling demographic and socioeconomic data, working with different geographic levels, and visualizing the results with ggplot2