R Package

The gerda R package provides tools to download and work with GERDA datasets directly in R. Current CRAN version: 0.5.0 (CRAN); development version: 0.6.0 (GitHub). As of v0.6 the package exposes 39 datasets covering local, state, federal, mayoral, European Parliament, and county (Kreistag) elections, plus crosswalks and covariates. Federal county-level data goes back to 1953; the other election families extend through 2025.

Python users

A lightweight Python loader is also available: gerda on PyPI (source: hhilbig/gerda-py). It exposes three functions — gerda.load(name), gerda.datasets(), and gerda.party_crosswalk(...) — and returns pandas DataFrames (or polars, optionally). Bundled covariate / Census merge helpers are not yet ported; use the R package for those.

pip install gerda
import gerda
df = gerda.load("federal_cty_harm")

Installation

# Install from CRAN
install.packages("gerda")

# Or install development version from GitHub
devtools::install_github("hhilbig/gerda")

Main Functions

Data Loading

Covariates (INKAR county-level, 1995–2022)

Census 2022 (Zensus, municipality-level)

Party Mapping

Usage Examples

library(gerda)

# List available datasets
gerda_data_list()

# Load harmonized municipal election data
municipal <- load_gerda_web("municipal_harm", verbose = TRUE)

# Load federal county data with socioeconomic covariates
federal_county <- load_gerda_web("federal_cty_harm") %>%
  add_gerda_covariates()

# View covariate definitions
gerda_covariates_codebook()

# Map party names to ParlGov
party_crosswalk(c("cdu_csu", "spd", "gruene"), "party_name_english")

Deprecations

As of v0.6, federal_cty_unharm exposes both the upstream columns (ags, year) and the canonical GERDA county-level names (county_code, election_year). The ags and year aliases will be removed in v0.7. New code should use county_code and election_year, which match the rest of the county-level datasets and work directly with add_gerda_covariates().

Documentation

Feedback

Feedback is welcome. Please email hhilbig@ucdavis.edu or open an issue on GitHub.