usdata v0.1.0


Monthly downloads



Data on the States and Counties of the United States

Demographic data on the United States at the county and state levels spanning multiple years.



status R build

This package contains demographic data on the United States at the county and state levels. The data span multiple years. Sources include the US Census, the American Community Survey, data distributed by the Bureau of Labor Statistics, etc.


You can install the package from CRAN with:


Additionally, you can install the development version of usdata from GitHub with:



The datasets from this package can be used in a teaching context for data visualization and data manipulation exercises as well as for modeling. Since data spans multiple years it’s also possible to use these data to explore trends in the US over time.

usdata and openintro

The datasets from this package are used in OpenIntro textbooks and other resources. These datasets originally lived in the openintro package, up until openintro 2.0.0. The motivation for extracting these datasets out of the openintro package was to create a new package where we can continue to add more data on the US at the state and county levels. For those looking for a seamless experience with OpenIntro resources, note that the contents of this package will be loaded along with the openintro package as well, so that you can run library(openintro) and use the datasets from usdata.

Questions, bugs, feature requests

You can file an issue to get help, report a bug, or make a feature request.

When filing an issue to get help or report a bug, please make a minimal reproducible example using the reprex package. If you haven’t heard of or used reprex before, you’re in for a treat! See here for additional reprex pointers.

Before opening a new issue, be sure to search issues and pull requests to make sure the bug hasn’t been reported and/or already fixed in the development version. By default, the search will be pre-populated with is:issue is:open. You can edit the qualifiers (e.g. is:pr, is:closed) as needed. For example, you’d simply remove is:open to search all issues in the repository, open or closed.

Code of Conduct

Please note that the usdata project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Functions in usdata

Name Description
state_stats State-level data
county_complete United States Counties
prrace08 Election results for the 2008 U.S. Presidential race
state2abbr Convert state names to abbreviations
urban_owner Summary of many state-level variables
senaterace10 Election results for the 2010 U.S. Senate races
govrace10 Election results for 2010 Governor races in the U.S.
abbr2state Convert state abbreviations to names
county United States Counties
usdata-package usdata: Data on the States and Counties of the United States
houserace10 Election results for the 2010 U.S. House of Represenatives races
vote_nsa Predicting who would vote for NSA Mass Surveillance
urban_rural_pop State summary info
No Results!

Last month downloads


License GPL-3
Encoding UTF-8
LazyData true
RoxygenNote 7.1.0
NeedsCompilation no
Packaged 2020-06-30 07:20:44 UTC; mine
Repository CRAN
Date/Publication 2020-06-30 09:20:03 UTC

Include our badge in your README