Title: | German Election Database (GERDA) |
Version: | 0.2.0 |
Author: | Hanno Hilbig |
Description: | Provides tools to download comprehensive datasets of local, state, and federal election results in Germany from 1990 to 2025. The package facilitates access to data on turnout, vote shares for major parties, and demographic information across different levels of government (municipal, state, and federal). It offers access to geographically harmonized datasets that account for changes in municipal boundaries over time and incorporate mail-in voting districts. Users can easily retrieve, clean, and standardize German electoral data, making it ready for analysis. Data is sourced from https://github.com/awiedem/german_election_data. |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.2 |
Depends: | R (≥ 2.10) |
Imports: | stringdist, dplyr, readr, knitr, tibble |
Suggests: | rmarkdown, testthat (≥ 3.0.0) |
Config/testthat/edition: | 3 |
URL: | https://github.com/hhilbig/gerda, https://github.com/awiedem/german_election_data |
BugReports: | https://github.com/hhilbig/gerda/issues |
VignetteBuilder: | knitr |
Maintainer: | Hanno Hilbig <hhilbig@ucdavis.edu> |
NeedsCompilation: | no |
Packaged: | 2025-08-12 09:43:16 UTC; hanno |
Repository: | CRAN |
Date/Publication: | 2025-08-19 12:50:02 UTC |
List of GERDA Data
Description
This function lists the available GERDA data sets. The purpose of this function is to quickly provide a list of available data sets and their descriptions.
Usage
gerda_data_list(print_table = TRUE)
Arguments
print_table |
A logical value indicating whether to print the table in the console (TRUE) or return the data as a tibble (FALSE). Default is TRUE. |
Value
A tibble containing the available GERDA data with descriptions. When print_table = TRUE, the function prints a formatted table to the console and invisibly returns the data tibble. When print_table = FALSE, the function directly returns the data tibble.
Examples
gerda_data_list()
Load GERDA Data
Description
This function loads GERDA data from a web source.
Usage
load_gerda_web(file_name, verbose = FALSE, file_format = "rds")
Arguments
file_name |
A character string specifying the name of the file to load. For a list of available data, see |
verbose |
A logical value indicating whether to print additional messages to the console. Default is FALSE. |
file_format |
A character string specifying the format of the file. Must be either "csv" or "rds". Default is "rds". |
Value
A tibble containing the loaded data, or NULL if the data could not be loaded.
Examples
# Load harmonized municipal elections data
data_municipal_harm <- load_gerda_web("municipal_harm", verbose = TRUE, file_format = "rds")
# Load federal election data harmonized to 2025 boundaries (includes 2025 election)
data_federal_2025 <- load_gerda_web("federal_muni_harm_25", verbose = TRUE, file_format = "rds")
GERDA
Description
This function creates a crosswalk between parties and their corresponding names using the ParlGov view_party table. In cases where the party name is not found in the view_party table, the function returns NA. Note that this function should be run on GERDA party names, and will likely not work on other party naming schemes.
Usage
party_crosswalk(party_gerda, destination)
Arguments
party_gerda |
A character vector containing the GERDA party names to be converted. |
destination |
The name of the column in the view_party table to map to. |
Value
A vector with the mapped party names.
Examples
party_crosswalk(c("cdu", "spd", "linke_pds", NA), "left_right")