Я пытаюсь использовать DT::datatable
для вывода красиво отформатированной интерактивной таблицы в R.
... проблема только в том, что я хочу, чтобы работа heroku вязала документ для меня, и я узнал, что RStudio и rmarkdown::render()
используют pandoc под капотом, - но pandoc не отправляется в урезанный R Buildpack для герою.
Есть ли способ получить старый механизм разметки (knitr:knit2html
или markdown:markdownToHTML
), чтобы передать javascript, который поддерживает datatable
через? Или, точнее, создать таблицу примеров ниже без использования pandoc?
Вот минимальный пример:
testing.Rmd
---
title: "testing"
output: html_document
---
this is a datatable table
```{r test2, echo=FALSE}
library(DT)
DT::datatable(
iris,
rownames = FALSE,
options = list(pageLength = 12, dom = 'tip')
)
```
this is regular R output
```{r}
head(iris)
```
knit_test.R
require(knitr)
knitr::knit2html('testing.Rmd')
генерирует:
this is a datatable table <!–html_preserve–>
<!–/html_preserve–>
this is regular R output
head(iris)
## Sepal.Length Sepal.Width Petal.Length Petal.Width Species
## 1 5.1 3.5 1.4 0.2 setosa
## 2 4.9 3.0 1.4 0.2 setosa
## 3 4.7 3.2 1.3 0.2 setosa
## 4 4.6 3.1 1.5 0.2 setosa
## 5 5.0 3.6 1.4 0.2 setosa
## 6 5.4 3.9 1.7 0.4 setosa
желаемое поведение: пройдите мой datatable (не <!–html_preserve–>
)
то, что я пробовал
Я посмотрел на htmltools и материал htmlPreserve
, но не мог понять, как применить это здесь. сделал некоторые сумасшедшие вещи с saveWidget
, которые не были успешными и не повторялись.
Спасибо!