This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(circlize) | |
| # Daten von infratest dimap auf tagesschau.de: | |
| # https://www.tagesschau.de/wahl/archiv/2025-02-23-BT-DE/analyse-wanderung.shtml | |
| data_raw <- list( | |
| # SPD | |
| list("FDP", "SPD", 120000), | |
| list("Nichtwähler", "SPD", 250000), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(dplyr) | |
| library(polmineR) | |
| library(data.table) | |
| # library(quanteda) | |
| dict <- c("Migration", "Flucht", "Asyl.*") | |
| speeches <- corpus("GERMAPARL2") %>% | |
| subset(protocol_year %in% 2013:2021) %>% | |
| as.speeches(s_attribute_date = "protocol_date", s_attribute_name = "speaker_who") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(pdftools) | |
| library(dplyr) | |
| library(tibble) | |
| fname <- "https://www.gruene-bw.de/wp-content/uploads/2021/01/GrueneBW-Landtagswahlprogramm-2021-Wachsen-wir-ueber-uns-hinaus.pdf" | |
| tmp <- tempfile(fileext = ".pdf") | |
| download.file(url = fname, destfile = tmp) | |
| doc <- pdftools::pdf_text(tmp) %>% | |
| gsub("-\\n\\s*", "", .) %>% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # snippet for 'Methodenanwendung in Praxisfeldern': | |
| # Framing immigration as "illegal" | |
| library(polmineR) | |
| library(dplyr) | |
| library(xts) | |
| library(lubridate) # we need lubridate::floor_date() | |
| look_up <- '"([iI]llegal.*|[fF]alsch.*|[uU]ndoku.*)" "(Migr.*|Flüchtl.*|Asyl.*)"' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| install.packages("remotes") | |
| remotes::install_github("PolMine/cwbtools", ref = "dev") | |
| library(cwbtools) | |
| corpus_install(doi = "10.5281/zenodo.7949074") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # last edit: 2023-06-23 | |
| library(polmineR) | |
| library(data.table) | |
| library(xts) | |
| afd <- corpus("GERMAPARL2") %>% | |
| subset(speaker_party == "AfD") %>% | |
| subset(protocol_lp == "19") %>% | |
| subset(p_type == "speech") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(polmineR) | |
| afd <- corpus("GERMAPARL2") %>% | |
| subset(speaker_party == "AfD") %>% | |
| subset(protocol_lp == "19") %>% | |
| subset(p_type == "speech") | |
| afd_count <- afd %>% | |
| count(p_attribute = "word") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Plot time series for multiple queries | |
| library(polmineR) | |
| library(dplyr) | |
| library(tidyr) | |
| library(xts) | |
| library(lubridate) # we need lubridate::floor_date() | |
| corpus_id <- "NADIRATAZ" | |
| look_up <- c("'Einwanderung.*'", "'Zuwanderung.*'") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(topicmodels) | |
| library(dplyr) | |
| library(magrittr) | |
| library(lubridate) | |
| library(data.table) | |
| library(xts) | |
| lda <- readRDS("~/Downloads/germaparl_lda_speeches_250.rds") | |
| topic_to_get <- 133 # Staatsangehörigkeit / Integration |
NewerOlder