rk.tidycensus

An RKWard GUI Plugin for US Census Bureau Data Extraction and Spatial Mapping

rk.tidycensus provides a seamless, point-and-click graphical interface inside RKWard to download microdata, socio-economic indicators, and spatial geometries from the US Census Bureau. Acting as a GUI wrapper for the powerful tidycensus R package by Kyle Walker, this plugin allows users to fetch, clean, and map census data without writing a single line of code.

This package includes a multi-component workflow: it not only downloads the data but also provides a dedicated plotter to map the spatial outputs instantly.


🌟 Key Features


⚙️ Prerequisites

You must have RKWard installed along with the following R packages:

install.packages(c("tidycensus", "sf", "ggplot2", "viridis"))

Note: You will need a free US Census Bureau API Key to download data. You can request one here.


🚀 Installation

You can install this plugin directly from GitHub using devtools:

# Install the plugin
# devtools::install_github("AlfCano/rk.tidycensus")
install.packages("rk.tidycensus", repos = c('https://alfcano.r-universe.dev', 'https://cloud.r-project.org'))

Once installed, open RKWard, navigate to Settings -> Configure RKWard -> Plugins, and activate rk.tidycensus.


🛠️ Usage Workflow

This plugin adds two new tools to your RKWard menus, designed to be used in sequence:

Step 1: Download US Census Data

Navigate to: Data ➔ Official Statistics ➔ Download US Census Data

  1. Setup & Source: Paste your Census API key (or leave it blank if you already saved it in your .Renviron). Select your desired survey (e.g., ACS 5-Year) and the Year.
  2. Geography & Variables: Choose your geographic level (e.g., County). Optionally filter by State (e.g., TX). Add your Census variable codes in the matrix (e.g., B01003_001 for Total Population).
  3. Output: Ensure "Download Spatial Geometry (sf)" is checked and click Submit. The data will be downloaded and saved to your workspace (e.g., us_census_data).

Step 2: Plot TidyCensus Map

Navigate to: Plots ➔ Maps ➔ Plot TidyCensus Map

Since tidycensus already binds the data to the spatial polygons, mapping is instantaneous:

  1. Data Input: Select your newly downloaded us_census_data object. Choose the value column you want to map (usually estimate).
  2. Appearance: Select a color palette (e.g., Viridis), add a Map Title, and customize the Legend.
  3. Output & Export: Preview the map instantly or export it directly as a high-resolution PNG or SVG. Click Submit.

🌍 Internationalization (i18n)

The graphical interface automatically adapts to your RKWard language settings. Currently supported languages:


📝 License and Author

Author: Alfonso Cano (@AlfCano)
Email: alfonso.cano@correo.buap.mx

This project is licensed under the GPL (>= 3) License.
Disclaimer: This package is a third-party GUI tool and is not officially affiliated with the US Census Bureau.