Marc Kupietz | 3e2c427 | 2023-11-15 11:27:25 +0100 | [diff] [blame^] | 1 | --- |
| 2 | title: "Frequenz von ›sozusagen‹: FOLK vs DeReKo" |
| 3 | author: "Marc Kupietz" |
| 4 | date: "`r Sys.Date()`" |
| 5 | output: |
| 6 | html_document: |
| 7 | css: "ids-style.css" |
| 8 | self_contained: false |
| 9 | fig_caption: true |
| 10 | |
| 11 | --- |
| 12 | |
| 13 | ```{r setup, include=FALSE} |
| 14 | knitr::opts_chunk$set(echo = TRUE) |
| 15 | ``` |
| 16 | |
| 17 | ## Boxplot-Demo mit R Markdown |
| 18 | |
| 19 | Diese Demonstration zeigt einen interaktiven Box-Plot mit Fehlerbalken im Corporate Design des IDS, generiert durch den dargestellten Code mit Hilfe der Pakete [RKorAPClient](https://github.com/KorAP/RKorAPClient), [highcharter](https://jkunst.com/highcharter/) und [knitr](https://cran.r-project.org/package=knitr). |
| 20 | |
| 21 | ```{r boxplot, warning=FALSE, message=FALSE, fig.cap='Vergleich der relativen Frequenz von ›sozusagen‹ des im virtuellen Korpus [DeReKo-KorAP](https://korap.ids-mannheim.de/doc/corpus) enthaltenen Teils von FOLK und dem restlichen Korpus. Durch Anklicken der Balken gelangt man zu den zugrundeliegenden KWICs, bzw. den zugrendeliegenden KorAP-Anfragen.'} |
| 22 | library(RKorAPClient) |
| 23 | library(highcharter) |
| 24 | library(idsThemeR) |
| 25 | |
| 26 | df <- new("KorAPConnection", verbose = FALSE) %>% |
| 27 | frequencyQuery("sozusagen/i", vc = c("corpusSigle=FOLK", "corpusSigle!=FOLK")) %>% |
| 28 | ipm() %>% |
| 29 | mutate(corpus = c("FOLK", "DeReKo")) |
| 30 | |
| 31 | highchart() %>% |
| 32 | hc_add_series(type = "column", data = df, hcaes(corpus, ipm)) %>% |
| 33 | hc_add_series( |
| 34 | data = df, |
| 35 | hcaes(x = corpus, y = ipm, low = conf.low, high = conf.high), |
| 36 | type = "errorbar", stemWidth = 2, whiskerWidth = 2, whiskerLength = 30) %>% |
| 37 | hc_yAxis(title=list(text="IPM")) %>% |
| 38 | hc_xAxis(categories = c("FOLK-Ausschnitt", "DeReKo")) %>% |
| 39 | hc_legend(enabled = FALSE) %>% |
| 40 | hc_add_theme(hc_theme_ids_light()) %>% |
| 41 | hc_add_onclick_korap_search() |
| 42 | |
| 43 | ``` |
| 44 | |