Add recursive CA demo to demo index
Change-Id: I37123eeed37dcec3bf54df0d5a6334a65488bfa1
diff --git a/demo/00Index b/demo/00Index
index c392b70..ad41293 100644
--- a/demo/00Index
+++ b/demo/00Index
@@ -9,3 +9,4 @@
displayKwics Display query results as KWICs via html
light-verb-construction-ca Collocation analysis to identify light verb constructions matching the pattern "in NN setzen", with result rendered as HTML DataTable
highcharter-example Visualize frequencies of optionally alternative terms over time with interactive HTML and JavaScript elements using the package highcharter as wrapper for Highcharts
+recursiveCA Show result dataframe of recursvie collocation analysis as pretty HTML tableb y Knitr via Markdown.
diff --git a/demo/recursiveCA.R b/demo/recursiveCA.R
index b121c49..1cff680 100644
--- a/demo/recursiveCA.R
+++ b/demo/recursiveCA.R
@@ -1,26 +1,27 @@
library(RKorAPClient)
library(tidyverse)
library(knitr)
+
+nodeWordform <- 'aufmerksam'
+mdFile <- tempfile(nodeWordform, fileext = ".md")
+
new("KorAPConnection", verbose = TRUE) %>%
collocationAnalysis(
- "aufmerksam",
+ nodeWordform,
leftContextSize = 2,
rightContextSize = 2,
exactFrequencies = TRUE,
searchHitsSampleLimit = 1000,
topCollocatesLimit = 10,
-# withinSpan = "",
maxRecurse = 1,
- addExamples = T
+ addExamples = TRUE
) %>%
-# mutate(LVC = sprintf("[aufmerksam %s](%s)", collocate, webUIRequestUrl)) %>%
- { . ->> cax } %>%
mutate(LVC = sprintf("[%s](%s)", example, webUIRequestUrl)) %>%
{ . ->> ca } %>%
select(LVC, logDice, pmi, ll) %>%
head(50) %>%
- kable(format="pipe", digits=2) %>%
- cat(file="/tmp/aufmerksam.md", sep="\n")
+ kable(format = "pipe", digits = 2) %>%
+ cat(file = mdFile, sep = "\n")
-rmarkdown::render("/tmp/aufmerksam.md")
-browseURL("/tmp/aufmerksam.html")
+rmarkdown::render(mdFile)
+browseURL(gsub("\\.md", ".html", mdFile))