replace Ü with UE in colnames in applause, move check of empty directory to beginning in read_all
This commit is contained in:
@@ -13,6 +13,9 @@ read_all <- function(path="records/") {
|
|||||||
available_protocols <- list.files(path)
|
available_protocols <- list.files(path)
|
||||||
res <- pblapply(available_protocols, read_one, path=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") %>%
|
lapply(res, `[[`, "redner") %>%
|
||||||
bind_rows() %>%
|
bind_rows() %>%
|
||||||
distinct() ->
|
distinct() ->
|
||||||
@@ -34,9 +37,6 @@ read_all <- function(path="records/") {
|
|||||||
distinct() ->
|
distinct() ->
|
||||||
commentsandapplause
|
commentsandapplause
|
||||||
|
|
||||||
if (length(available_protocols) == 0)
|
|
||||||
warning("The given directory is empty or does not exist.")
|
|
||||||
|
|
||||||
filter(commentsandapplause, type == "comment") %>%
|
filter(commentsandapplause, type == "comment") %>%
|
||||||
select(-type) ->
|
select(-type) ->
|
||||||
comments
|
comments
|
||||||
@@ -46,7 +46,7 @@ read_all <- function(path="records/") {
|
|||||||
"SPD" = str_detect(fraktion, "SPD"),
|
"SPD" = str_detect(fraktion, "SPD"),
|
||||||
"FDP" = str_detect(fraktion, "FDP"),
|
"FDP" = str_detect(fraktion, "FDP"),
|
||||||
"DIE_LINKE" = str_detect(fraktion, "DIE LINKE"),
|
"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")) %>%
|
"AfD" = str_detect(fraktion, "AfD")) %>%
|
||||||
select(-fraktion) ->
|
select(-fraktion) ->
|
||||||
applause
|
applause
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ res$applause %>%
|
|||||||
group_by(on_fraktion) %>%
|
group_by(on_fraktion) %>%
|
||||||
arrange(on_fraktion) %>%
|
arrange(on_fraktion) %>%
|
||||||
summarize("AfD" = sum(`AfD`),
|
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`),
|
"CDU/CSU" = sum(`CDU_CSU`),
|
||||||
"DIE LINKE" = sum(`DIE_LINKE`),
|
"DIE LINKE" = sum(`DIE_LINKE`),
|
||||||
"FDP" = sum(`FDP`),
|
"FDP" = sum(`FDP`),
|
||||||
|
|||||||
Reference in New Issue
Block a user