The Census Bureau collects useful demographic data on the US population and makes it available through API connections. Anyone can access this data for free using the R programming language.
This post will teach you how to do that. I’ll show you how to search metadata to find what you’re looking for and then pull the specific variables you need.
(Side note: If you’re looking for a quick overview of available data from the Census Bureau, you can read my other post here or review the Census Bureau’s API page here.)