The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Introduction to gerda

library(gerda)

Overview

The gerda package provides functions to access and work with GERDA datasets. The German Election Database (GERDA) provides a comprehensive dataset of local, state, and federal election results in Germany. The data is intended to facilitate research on electoral behavior, representation, and political responsiveness at multiple levels of government. All datasets include turnout and vote shares for all major parties. Moreover, GERDA contains geographically harmonized datasets that account for changes in municipal boundaries and mail-in voting districts.

GERDA was compiled by Vincent Heddesheimer, Florian Sichart, Andreas Wiedemann and Hanno Hilbig.

This vignette will introduce you to the main functions of the package and demonstrate how to use them.

Available Datasets

To see a list of all available GERDA datasets, you can use the gerda_data_list() function:

gerda_data_list()
#> |data_name           |description                                                                         |
#> |:-------------------|:-----------------------------------------------------------------------------------|
#> |municipal_unharm    |Local elections at the municipal level (1990-2020, unharmonized).                   |
#> |municipal_harm      |Local elections at the municipal level (1990-2020, harmonized).                     |
#> |state_unharm        |State elections at the municipal level (2006-2019, unharmonized).                   |
#> |state_harm          |State elections at the municipal level (2006-2019, harmonized).                     |
#> |federal_muni_raw    |Federal elections at the municipal level (1980-2021, raw data).                     |
#> |federal_muni_unharm |Federal elections at the municipal level (1980-2021, unharmonized).                 |
#> |federal_muni_harm   |Federal elections at the municipal level (1990-2021, harmonized).                   |
#> |federal_cty_unharm  |Federal elections at the county level (1953-2021, unharmonized).                    |
#> |federal_cty_harm    |Federal elections at the county level (1990-2021, harmonized).                      |
#> |ags_crosswalks      |Crosswalks for municipalities (1990-2021).                                          |
#> |cty_crosswalks      |Crosswalks for counties (1990-2021).                                                |
#> |ags_area_pop_emp    |Crosswalk covariates (area, population, employment) for municipalities (1990-2021). |
#> |cty_area_pop_emp    |Crosswalk covariates (area, population, employment) for counties (1990-2021).       |

This function displays a formatted table with the names and descriptions of all available datasets.

Loading Data

The main function for loading GERDA data is load_gerda_web(). This function allows you to load a specific dataset from a web source. Here’s an example of how to use it:

# Load the municipal harmonized dataset
municipal_harm_data <- load_gerda_web("municipal_harm", verbose = TRUE, file_format = "rds")

The load_gerda_web() function takes the following parameters:

Example Workflow

Here’s an example of a typical workflow using the gerda package:

  1. List available datasets:
gerda_data_list()
#> |data_name           |description                                                                         |
#> |:-------------------|:-----------------------------------------------------------------------------------|
#> |municipal_unharm    |Local elections at the municipal level (1990-2020, unharmonized).                   |
#> |municipal_harm      |Local elections at the municipal level (1990-2020, harmonized).                     |
#> |state_unharm        |State elections at the municipal level (2006-2019, unharmonized).                   |
#> |state_harm          |State elections at the municipal level (2006-2019, harmonized).                     |
#> |federal_muni_raw    |Federal elections at the municipal level (1980-2021, raw data).                     |
#> |federal_muni_unharm |Federal elections at the municipal level (1980-2021, unharmonized).                 |
#> |federal_muni_harm   |Federal elections at the municipal level (1990-2021, harmonized).                   |
#> |federal_cty_unharm  |Federal elections at the county level (1953-2021, unharmonized).                    |
#> |federal_cty_harm    |Federal elections at the county level (1990-2021, harmonized).                      |
#> |ags_crosswalks      |Crosswalks for municipalities (1990-2021).                                          |
#> |cty_crosswalks      |Crosswalks for counties (1990-2021).                                                |
#> |ags_area_pop_emp    |Crosswalk covariates (area, population, employment) for municipalities (1990-2021). |
#> |cty_area_pop_emp    |Crosswalk covariates (area, population, employment) for counties (1990-2021).       |
  1. Load a dataset (in this case, the federal elections at the county level, harmonized):
federal_cty_harm <- load_gerda_web("federal_cty_harm", verbose = TRUE)

Conclusion

The gerda package provides easy access to a wide range of German election and related data. By using the gerda_data_list() function to explore available datasets and load_gerda_web() to load them, you can quickly incorporate this data into your research or analysis projects.

For more information or to provide feedback, please contact or visit the GitHub repository at https://github.com/hhilbig/gerda.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.