remove funwithdata, add some text, improve some fig heights
This commit is contained in:
+12
-14
@@ -32,20 +32,12 @@ Second, those `.xml` files, need to be parsed into `R` `tibbles`. This is accomp
|
||||
```r
|
||||
read_all("../inst/records/") %>% repair() -> res
|
||||
```
|
||||
We also used `repair` to fix a bunch of formatting issues in the records and unpacked
|
||||
the result into more descriptive variables.
|
||||
We also used `repair` to fix a bunch of formatting issues in the records.
|
||||
|
||||
For development purposes, we load the tables from csv files.
|
||||
```{r}
|
||||
res <- read_from_csv('../inst/csv/')
|
||||
```
|
||||
and unpack our tibbles
|
||||
```{r}
|
||||
comments <- res$comments
|
||||
speeches <- res$speeches
|
||||
speaker <- res$speaker
|
||||
talks <- res$talks
|
||||
```
|
||||
|
||||
## Analysis
|
||||
|
||||
@@ -53,7 +45,7 @@ Now we can start analysing our parsed dataset:
|
||||
|
||||
### Counting the occurences of a given word:
|
||||
|
||||
```{r, fig.width=7}
|
||||
```{r, fig.width=7, fig.height=7}
|
||||
find_word(res, "Kohleausstieg") %>%
|
||||
filter(occurences > 0) %>%
|
||||
join_speaker(res) %>%
|
||||
@@ -63,17 +55,22 @@ find_word(res, "Kohleausstieg") %>%
|
||||
summarize(n = n()) %>%
|
||||
arrange(desc(n)) %>%
|
||||
bar_plot_fractions(title = "Parties using the word 'Kohleausstieg' the most (absolutely)",
|
||||
ylab = "Number of uses of 'Kohleausstieg'",
|
||||
flipped = F)
|
||||
ylab = "Number of uses of 'Kohleausstieg'",
|
||||
flipped = F,
|
||||
rotatelab = T)
|
||||
```
|
||||
|
||||
### When are which topics discussed the most?
|
||||
|
||||
```{r, fig.width=7}
|
||||
First we define some search patterns, according to some common political topics.
|
||||
```{r}
|
||||
pandemic_pattern <- "(?i)virus|corona|covid|lockdown"
|
||||
climate_pattern <- "(?i)klimawandel|erderwärmung|co2|treibhaus|methan|kyoto-protokoll|klimaabkommen"
|
||||
pension_pattern <- "(?i)rente|pension|altersarmut"
|
||||
|
||||
```
|
||||
Then we use the analysis helper `word_usage_by_date` to generate a tibble counting the
|
||||
occurences of our search patterns per date. We can then plot the results:
|
||||
```{r, fig.width=7, fig.height=6}
|
||||
word_usage_by_date(res, c(pandemic = pandemic_pattern,
|
||||
climate = climate_pattern,
|
||||
pension = pension_pattern)) %>%
|
||||
@@ -83,3 +80,4 @@ word_usage_by_date(res, c(pandemic = pandemic_pattern,
|
||||
labs(color = "Topic") +
|
||||
geom_point()
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user