Add RMarkdown example with highcharter plot and css files
Change-Id: I2cfd3dc099b7c1bdd83c1520e290dab84e93abd6
diff --git a/inst/examples/hc_boxplot.Rmd b/inst/examples/hc_boxplot.Rmd
new file mode 100644
index 0000000..a392068
--- /dev/null
+++ b/inst/examples/hc_boxplot.Rmd
@@ -0,0 +1,44 @@
+---
+title: "Frequenz von ›sozusagen‹: FOLK vs DeReKo"
+author: "Marc Kupietz"
+date: "`r Sys.Date()`"
+output:
+ html_document:
+ css: "ids-style.css"
+ self_contained: false
+ fig_caption: true
+
+---
+
+```{r setup, include=FALSE}
+knitr::opts_chunk$set(echo = TRUE)
+```
+
+## Boxplot-Demo mit R Markdown
+
+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).
+
+```{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.'}
+library(RKorAPClient)
+library(highcharter)
+library(idsThemeR)
+
+df <- new("KorAPConnection", verbose = FALSE) %>%
+ frequencyQuery("sozusagen/i", vc = c("corpusSigle=FOLK", "corpusSigle!=FOLK")) %>%
+ ipm() %>%
+ mutate(corpus = c("FOLK", "DeReKo"))
+
+highchart() %>%
+ hc_add_series(type = "column", data = df, hcaes(corpus, ipm)) %>%
+ hc_add_series(
+ data = df,
+ hcaes(x = corpus, y = ipm, low = conf.low, high = conf.high),
+ type = "errorbar", stemWidth = 2, whiskerWidth = 2, whiskerLength = 30) %>%
+ hc_yAxis(title=list(text="IPM")) %>%
+ hc_xAxis(categories = c("FOLK-Ausschnitt", "DeReKo")) %>%
+ hc_legend(enabled = FALSE) %>%
+ hc_add_theme(hc_theme_ids_light()) %>%
+ hc_add_onclick_korap_search()
+
+```
+
diff --git a/inst/examples/ids-style.css b/inst/examples/ids-style.css
new file mode 100644
index 0000000..82b9a6a
--- /dev/null
+++ b/inst/examples/ids-style.css
@@ -0,0 +1,57 @@
+@import url('https://code.cdn.mozilla.net/fonts/fira.css');
+@import url('https://korap.ids-mannheim.de/font/libertinus.css');
+@import url('https://korap.ids-mannheim.de/font/fira-condensed.css');
+
+h1, h2, h3, h4, h5, h6 {
+ font-family: 'Fira Sans Condensed',sans-serif;
+ margin: 0 0 1rem;
+ line-height: 1.2;
+ font-weight: bold;
+}
+
+.title, .subtitle {
+ text-transform: uppercase;
+ text-align: center;
+}
+
+.date, .author {
+ text-align: center;
+}
+
+body {
+ font-family: 'Libertinus Math', 'Libertinus Serif', serif;
+ font-size: 18px;
+ font-weight: 400;
+ font-variant-ligatures: common-ligatures;
+}
+
+table {
+ font-family: 'Fira Sans', sans-serif;
+ font-variant-numeric: tabular-nums;
+}
+
+
+p {
+ hyphens: auto;
+ text-align: justify;
+ overflow-wrap: break-word;
+}
+
+.footnotes {
+ font-family: 'Fira Sans Condensed', sans-serif;
+ font-weight: 400;
+ font-size: 14px;
+ line-height: 1.5;
+}
+
+#TOC > ul {
+ font-family: 'Fira Sans', sans-serif;
+}
+
+.caption, caption {
+ font-family: 'Fira Sans Condensed', sans-serif;
+ font-weight: 400;
+ font-size: 16px;
+ text-align: center;
+ color: #777;
+}