MyNixOS website logo
Description

Classification and Scoring of U.S. County and ZIP Code Rurality.

Provides USDA Rural-Urban Continuum Codes (RUCC 2023), Rural-Urban Commuting Area codes (RUCA 2020), and a composite rurality score for all U.S. counties. Functions enable lookup by FIPS code, ZIP code, or county name, and easy merging with existing datasets. Data sources include the USDA Economic Research Service, U.S. Census Bureau American Community Survey, and Census TIGER/Line shapefiles.

rurality rurality package hex sticker

CRAN status R-CMD-check pkgdown Lifecycle: stable

Documentation: https://cwimpy.github.io/rurality/

Rurality classification and scoring for U.S. counties and ZIP codes.

Provides USDA Rural-Urban Continuum Codes (RUCC 2023), Rural-Urban Commuting Area codes (RUCA 2020), and a composite rurality score for all 3,235 U.S. counties. Built to make rurality data easy to use in research without manually downloading and merging USDA spreadsheets.

Web app:rurality.app

Install

install.packages("rurality")

Or install the development version from GitHub:

# install.packages("devtools")
devtools::install_github("cwimpy/rurality")

Usage

library(rurality)

# Look up a county by FIPS
get_rurality("05031")
#> Craighead County, AR — Score: 40 (Mixed), RUCC: 3

# Just the score
rurality_score("05031")
#> 40

# Just the RUCC code
get_rucc("05031")
#> 3

# RUCA code for a ZIP
get_ruca("72401")
#> Primary RUCA: 1 (Metropolitan core)

# Merge onto your own data
my_data <- data.frame(
  fips = c("05031", "06037", "48453"),
  outcome = c(0.7, 0.4, 0.6)
)
my_data |> add_rurality()

# Add all available variables
my_data |> add_rurality(vars = "all")

Data

The package ships two datasets:

county_rurality

All 3,235 U.S. counties with 24 variables including:

VariableDescription
fips5-digit county FIPS code
rurality_scoreComposite score (0-100)
rurality_classificationUrban, Suburban, Mixed, Rural, Very Rural
rucc_2023USDA Rural-Urban Continuum Code (1-9)
pop_densityPopulation per square mile
dist_large_metroDistance to nearest large metro (miles)
median_incomeACS 2022 median household income
median_ageACS 2022 median age
# Browse the full dataset
county_rurality

# Filter to a state
county_rurality |> dplyr::filter(state_abbr == "AR")

# Distribution
table(county_rurality$rurality_classification)
#> Mixed    Rural Suburban    Urban Very Rural
#>   663      921      781       87        783

ruca_codes

USDA RUCA codes (2020) for 41,146 ZIP code tabulation areas.

ruca_codes |> dplyr::filter(state == "AR")

Methodology

The composite rurality score is a weighted average of three components:

ComponentWeightSource
RUCC score55%USDA Economic Research Service, 2023
Population density28%Census ACS 2022 5-year estimates
Distance to metro17%Haversine distance to nearest metro area

Scores range from 0 (most urban) to 100 (most rural). See the full methodology for details.

Citation

If you use this package in published research, please cite:

Wimpy, Cameron (2026). rurality: Rurality Classification and Scoring
  for U.S. Counties and ZIP Codes. R package version 0.1.0.
  https://github.com/cwimpy/rurality

Data Sources

License

MIT.

Metadata

Version

0.1.1

License

Unknown

Platforms (80)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arc-linux
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • sh4-linux
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows