An R package to analyze the parliamentary records of the 19th legislative period of the Bundestag, the German parliament.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

39 linhas
1.0KB

  1. source("../utils/helpers.R")
  2. fraktionen <- c("AFD" = "AfD",
  3. "BÜNDNIS90/" = "BÜNDNIS 90 / DIE GRÜNEN",
  4. "BÜNDNIS90/DIEGRÜNEN" = "BÜNDNIS 90 / DIE GRÜNEN",
  5. "FRAKTIONSLOS" = "Fraktionslos",
  6. "DIELINKE" = "DIE LINKE",
  7. "SPD" = "SPD",
  8. "CDU/CSU" = "CDU/CSU",
  9. "FDP" = "FDP")
  10. # expects a tibble of redner and repairs
  11. repair_fraktion <- function(fraktion) {
  12. cleaned <- str_to_upper %$% str_replace_all(fraktion, "\\s", "")
  13. fraktionen[cleaned]
  14. }
  15. repair_redner <- function(redner) {
  16. # fix fraktionsnames
  17. redner %>% mutate(fraktion = Vectorize(repair_fraktion)(fraktion))
  18. }
  19. repair_reden <- function(reden) {
  20. # TODO: fill with content
  21. reden
  22. }
  23. repair_talks <- function(talks) {
  24. # TODO: fill with content
  25. talks
  26. }
  27. # repairs all tables
  28. repair <- function(parse_output) {
  29. list(redner = repair_redner(parse_output$redner),
  30. reden = repair_reden(parse_output$reden),
  31. talks = repair_talks(parse_output$talks))
  32. }