From 64ede5c757ae12ec4332c303c1517c9bf41e21c3 Mon Sep 17 00:00:00 2001 From: flavis Date: Tue, 3 Aug 2021 12:48:01 +0200 Subject: [PATCH] =?UTF-8?q?replace=20=C3=9C=20with=20UE=20in=20colnames=20?= =?UTF-8?q?in=20applause,=20move=20check=20of=20empty=20directory=20to=20b?= =?UTF-8?q?eginning=20in=20read=5Fall?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- R/parse.R | 8 ++++---- vignettes/funwithdata.Rmd | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/R/parse.R b/R/parse.R index 40b6045..603c358 100644 --- a/R/parse.R +++ b/R/parse.R @@ -13,6 +13,9 @@ read_all <- function(path="records/") { available_protocols <- list.files(path) res <- pblapply(available_protocols, read_one, path=path) + if (length(available_protocols) == 0) + stop("The given directory is empty or does not exist.") + lapply(res, `[[`, "redner") %>% bind_rows() %>% distinct() -> @@ -34,9 +37,6 @@ read_all <- function(path="records/") { distinct() -> commentsandapplause - if (length(available_protocols) == 0) - warning("The given directory is empty or does not exist.") - filter(commentsandapplause, type == "comment") %>% select(-type) -> comments @@ -46,7 +46,7 @@ read_all <- function(path="records/") { "SPD" = str_detect(fraktion, "SPD"), "FDP" = str_detect(fraktion, "FDP"), "DIE_LINKE" = str_detect(fraktion, "DIE LINKE"), - "BÜNDNIS_90_DIE_GRÜNEN" = str_detect(fraktion, "BÜNDNIS 90/DIE GRÜNEN"), + "BUENDNIS_90_DIE_GRUENEN" = str_detect(fraktion, "BÜNDNIS 90/DIE GRÜNEN"), "AfD" = str_detect(fraktion, "AfD")) %>% select(-fraktion) -> applause diff --git a/vignettes/funwithdata.Rmd b/vignettes/funwithdata.Rmd index d5dded1..fbfe4af 100644 --- a/vignettes/funwithdata.Rmd +++ b/vignettes/funwithdata.Rmd @@ -107,7 +107,7 @@ res$applause %>% group_by(on_fraktion) %>% arrange(on_fraktion) %>% summarize("AfD" = sum(`AfD`), - "BÜNDNIS 90 / DIE GRÜNEN" = sum(`BÜNDNIS_90_DIE_GRÜNEN`), + "BÜNDNIS 90 / DIE GRÜNEN" = sum(`BUENDNIS_90_DIE_GRUENEN`), "CDU/CSU" = sum(`CDU_CSU`), "DIE LINKE" = sum(`DIE_LINKE`), "FDP" = sum(`FDP`),