light verb construction demo: use proper tempfile

Change-Id: I9aec0967b761dc2b833f4ea4e1a1604e2b1d2774
diff --git a/demo/light-verb-construction-ca.R b/demo/light-verb-construction-ca.R
index c8a323e..51d73c1 100644
--- a/demo/light-verb-construction-ca.R
+++ b/demo/light-verb-construction-ca.R
@@ -1,20 +1,28 @@
 library(RKorAPClient)
+library(tidyverse)
 library(knitr)
+library(rmarkdown)
+
+lvLemma <- "nehmen"
+
+mdFile <- tempfile(lvLemma, fileext = ".md")
+
+cat(file=mdFile, sprintf("---\ntitle: LVC analysis of %s\n---\n\n", lvLemma))
+
 new("KorAPConnection", verbose = TRUE) %>%
   collocationAnalysis(
-    "focus(in [tt/p=NN] {[tt/l=setzen]})",
+    sprintf("focus(in [tt/p=NN] {[tt/l=%s]})", lvLemma),
     leftContextSize = 1,
     rightContextSize = 0,
     exactFrequencies = FALSE,
     searchHitsSampleLimit = 1000,
     topCollocatesLimit = 20
   ) %>%
-  mutate(LVC = sprintf("[in %s setzen](%s)", collocate, webUIRequestUrl)) %>%
+  mutate(LVC = sprintf("[in %s %s](%s)", collocate, lvLemma, webUIRequestUrl)) %>%
   select(LVC, logDice, pmi, ll) %>%
   head(10) %>%
-  kable(format="pipe", digits=2)  %>%
-  cat(file="/tmp/in_setzen.md", sep="\n")
+  kable(format = "pipe", digits = 2)  %>%
+  cat(file = mdFile, sep = "\n", append = TRUE)
 
-#rmarkdown::render("/tmp/in_setzen.md")
-#browseURL("/tmp/in_setzen.html")
-
+rmarkdown::render(mdFile)
+browseURL(str_replace(mdFile, "\\.md$", ".html"))