Is there a way to compile RMarkdown documents with datatables produced by DT outside of RStudio?
I'm trying to include a datatable widget in an RMarkdown document that I then want to convert to html using knitr and pandoc. This works fine with RStudio but if I try to do the same with knitr and pandoc I'm unable to get a working html file.
Here is a minimal example of an Rmd file that works with RStudio but not otherwise:
---
title: "Minimal DT example"
---
<style type="text/css"> table, table th, table td { border: none; } </style>
```{r}
library(DT)
datatable(iris)
```
Which I would then like to convert to html using:
knitr::knit('example.Rmd')
knitr::pandoc('example.md',format="html")
I am aware that RStudio uses a much more complicated pandoc call:
/usr/lib/rstudio/bin/pandoc/pandoc scratch.utf8.md --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output scratch.html --smart --email-obfuscation none --self-contained --standalone --section-divs --template /home/user/R/x86_64-pc-linux-gnu-library/3.1/rmarkdown/rmd/h/default.html --variable 'theme:bootstrap' --include-in-header /tmp/RtmpMLtVfF/rmarkdown-str24935297671d.html --mathjax --variable 'mathjax-url:https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --no-highlight --variable highlightjs=/home/user/R/x86_64-pc-linux-gnu-library/3.1/rmarkdown/rmd/h/highlight
which I can recreate up to the part where this tmp file is included in the header:
/tmp/RtmpMLtVfF/rmarkdown-str24935297671d.html
I assume that this file contains the js sources for jquery and datatables. I have tried to add them by hand from the package source - but not succeeded - and would anyways like a solution that works out of the box.