Introducing rurality: a one-stop R package for U.S. rural–urban data

R
package
rural
methodology
rurality
A new R package that puts USDA’s Rural–Urban Continuum Codes, Commuting Areas, and a composite rurality score.
Author

Cameron Wimpy

Published

4/13/2026

Modified

4/13/2026

If you do any applied work on rural America, you’ve probably hit the same wall I have: the data you need isn’t on CRAN. It’s on USDA’s website, spread across half a dozen Excel files, with column names that change between vintages and codebooks that live in separate PDFs.

rurality is a new R package I built to make that wall disappear. Install it, load it, get a tidy tibble of rural–urban classifications for every U.S. county and ZIP code. That’s the pitch.

install.packages("rurality")

What’s inside

The package ships three things, all on CRAN, all keyed by FIPS or ZIP:

  • USDA Rural–Urban Continuum Codes (RUCC 2023): the nine-point metro–nonmetro scale, one row per county.
  • USDA Rural–Urban Commuting Area Codes (RUCA 2020): finer-grained, commuting-flow-based, one row per ZIP.
  • A composite rurality score: a single continuous measure I built for situations where you want more resolution than RUCC but don’t want to hand your reviewers two different classification systems to reconcile.

All three are available through a single consistent interface. You don’t have to know which USDA file they came from or which release year is current.

The shape of the API

library(rurality)

# Every U.S. county with its RUCC and composite score
counties <- rurality_counties()

# Every ZIP with RUCA
zips <- rurality_zips()

# Attach rurality to your own data by FIPS or ZIP
my_data |>
  rurality_join(by = "fips")

That’s it. No read_excel, no FIPS padding, no column renaming, no digging for the latest codebook.

Why a package instead of a cleaned-up CSV?

Two reasons.

First, the data is going to change. USDA releases a new RUCC vintage every ten years or so, and RUCA on its own cadence. Wiring the data into a package means when a new release drops, every project downstream gets the update with update.packages(). No one has to remember which CSV they downloaded in which project folder.

Second, a consistent API is what social scientists actually need. Half the “rural” studies I review are built on whichever classification the author happened to find first. A package possible standardizes those choices, everyone is using the same definitions, with the same vintages, documented in one place.

Behind the composite score

The composite score is the piece I’m most nervous about and most excited about. It’s designed to give you a continuous measure in situations where collapsing 9 RUCC buckets into “rural vs. urban” throws away too much signal, but where keeping all 9 as categorical dummies eats your degrees of freedom.

Under the hood it combines RUCC, population density, distance to the nearest metro, and a handful of other county characteristics into a single scalar, standardized across the full 3,235-county universe. If you use it in a paper, please cite the package and the documentation site, I’d like to know where it’s showing up.

A companion: the rurality app

There’s also a companion web app at rurality.app for exploring the data without opening R. Type in a county, get its scores. Useful for students, policymakers, or anyone who needs a quick lookup without writing code. The Stata port (rurality-stata) mirrors the R API for folks living on the other side of the open-source aisle.

Where this came from

I built rurality because I got tired of copying the same USDA-download script into every new project, and because the Institute for Rural Initiatives I direct at Arkansas State is in the business of making rural public policy research easier to do. A good chunk of what we try to do at IRI is lower the friction between “interesting question about rural America” and “peer-reviewable answer.” This package is one small brick in that wall.

What’s next

A few things on the roadmap:

  • Historical RUCC coverage so you can build change-over-time panels without manually joining 2003, 2013, and 2023 releases. (The homepage map on cwimpy.com already does this for 2013 → 2023; the plan is to make that kind of analysis one line of code.)
  • RUCA on a county-aggregate basis for users who need commuting-flow information without descending to ZIP level.
  • Vignettes for common applied workflowsm which involve merging onto survey data, stratifying outcomes by rurality, building the kind of figures that make rural variation legible to readers who don’t live there.

If you have thoughts, feature requests, or a use case I haven’t anticipated, the GitHub issue tracker is open, and I try to respond within a week or two. Pull requests welcome too as the package is MIT-licensed.

If you just want to try it, the whole thing is one install away:

install.packages("rurality")

Happy merging.

Back to top