|
- #' @export
- find_word <- function(res, word) {
- talks <- res$talks
- mutate(talks, occurences = sapply(str_match_all(talks$content, regex(word, ignore_case = TRUE)),
- nrow))
- }
-
- #' @export
- join_redner <- function(tb, res, fraktion_only = F) {
- joined <- left_join(tb, res$redner, by=c("redner" = "id"))
- if (fraktion_only) select(joined, "fraktion")
- else joined
- }
-
- party_colors <- c(
- SPD="#DF0B25",
- "CDU/CSU"="#000000",
- AfD="#1A9FDD",
- "AfD&Fraktionslos"="#1A9FDD",
- "DIE LINKE"="#BC3475",
- "BÜNDNIS 90 / DIE GRÜNEN"="#4A932B",
- FDP="#FEEB34",
- Fraktionslos="#FEEB34"
- )
-
- #' @export
- bar_plot_fraktionen <- function(tb) {
- ggplot(tb, aes(x = reorder(fraktion, -n), y = n, fill = fraktion)) +
- scale_fill_manual(values = party_colors) +
- geom_bar(stat = "identity")
- }
|