Marc Kupietz | 08d222b | 2020-01-16 09:19:08 +0100 | [diff] [blame] | 1 | library(RKorAPClient) |
Marc Kupietz | 07deae0 | 2021-03-05 12:15:07 +0100 | [diff] [blame^] | 2 | library(htmlwidgets) |
Marc Kupietz | 08d222b | 2020-01-16 09:19:08 +0100 | [diff] [blame] | 3 | |
| 4 | plotHighchart <- function(query = "Schlumpf", |
| 5 | years = c(2000:2010), |
| 6 | as.alternatives = length(query) > 1, |
| 7 | vc = "textType = /Zeit.*/ & availability!=QAO-NC-LOC:ids & pubDate in", |
Marc Kupietz | cf1771d | 2020-03-04 16:03:04 +0100 | [diff] [blame] | 8 | kco = new("KorAPConnection", verbose=TRUE) ) { |
Marc Kupietz | 08d222b | 2020-01-16 09:19:08 +0100 | [diff] [blame] | 9 | hc <- |
| 10 | frequencyQuery(kco, query, paste(vc, years), as.alternatives=as.alternatives) %>% |
| 11 | hc_freq_by_year_ci(as.alternatives) |
| 12 | print(hc) |
| 13 | hc |
| 14 | } |
| 15 | |
| 16 | saveHCPlot <- function(hc, fname) { |
Marc Kupietz | cf1771d | 2020-03-04 16:03:04 +0100 | [diff] [blame] | 17 | htmlwidgets::saveWidget(hc, file=fname, selfcontained = TRUE) |
Marc Kupietz | 08d222b | 2020-01-16 09:19:08 +0100 | [diff] [blame] | 18 | } |
| 19 | |
| 20 | #h1 <-plotHighchart(c("macht []{0,3} Sinn", "ergibt []{0,3} Sinn"), c(1980:2018)) |
Marc Kupietz | cf1771d | 2020-03-04 16:03:04 +0100 | [diff] [blame] | 21 | h1 <- plotHighchart(c("Leser | Lesern | Lesers", 'Leserin | Leserinnen', 'LeserIn | LeserInnen', '"Leser[_\\*]in.*"'), c(1985:2018), as.alternatives = FALSE) |
Marc Kupietz | 08d222b | 2020-01-16 09:19:08 +0100 | [diff] [blame] | 22 | #plotHighchart(c("Tollpatsch", "Tolpatsch"), c(1991:2018)) |
| 23 | |
Marc Kupietz | 91145b0 | 2020-01-29 15:58:36 +0100 | [diff] [blame] | 24 | |