Skip to content

max-alletsee/tidy_bundestag

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tidy_bundestag

This repository contains R code to create tidy datasets for the German Bundestag election results.

The original data is provided by the Federal Returning Officer (Bundeswahlleiter). The concept of tidy data is explained by Hadley Wickham in his article "Tidy Data" in the Journal of Statistical Software (2014, Vol. 59, Issue 10).

Note that this is currently work in progress: I started with the 1949 Bundestag elections and will slowly work towards more recent elections. This project has been inspired by similar projects from Arndt Leininger and Marie-Louise Timcke who both focused on the 2017 elections.

Folders and Files

The folder code contains the R code to transform the un-tidy raw data into tidy data. The file names refer to the election years: tidy_1949.r refers to the 1949 Bundestag elections.

The original data as provided on the website of the Federal Returning Officer can be found in the folder data_raw. The resulting tidy datasets that are created when running the R code are stored in the folder data_tidy.

Variable Structure

The R code creates two different files for each election: ..._districts includes district-level results, whereas ..._states shows results for the states (Länder) and for the federal level.

Each row in the tidy dataset shows the election results for one party in one electoral district in one election for one type of vote ("Erststimme", "Zweitstimme"). The tidy datasets have the following variable structure:

  • district_no: number of the electoral district
  • district_name: name of the electoral district
  • state: name of the state to which the electoral district belongs (for results on state level: abbreviated name of the state)
  • party_short: abbreviated party name
  • party_long: full party name
  • vote_type: "Erststimme", "Zweitstimme"
  • year: year of election
  • votes_party_district: absolute number of votes for the respective party in the electoral district
  • voteshare_party_district: vote share for the respective party in the electoral district, in %
  • voters_district: total number of voters in the respective electoral district (both valid and invalid votes)
  • validvotes_district: valid votes for all parties in the respective electoral district
  • invalidvotes_district: invalid votes in the respective electoral district
  • eligible_district: absolute number of eligible voters in the respective district
  • turnout_district: voter turnout in the electoral district, in %

Original Data

The Federal Returning Officer provides a PDF file with an overview of all Bundestag elections: Ergebnisse früherer Bundestagswahlen.

Moreover, there are separate websites with the results for each election as well the possibility to download the raw data:

About

Tidy data for the Bundestag election results in Germany

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages