如何将脚本中的DT::datatable
对象显示到pdf文档中?我的代码到目前为止分解,出现以下错误:如何使用rmarkdown在pdf中呈现DT :: datatables?
processing file: reportCopy.Rmd
output file: reportCopy.knit.md
Functions that produce HTML output found in document targeting latex output.
Please change the output type of this document to HTML.
包括在YAML头always_allow_html: yes
抑制错误,但没有出现在PDF格式。
我将不胜感激任何帮助。我的代码是目前:
---
title: "DT"
output: pdf_document
---
### Chart 1
```{r}
DT::datatable(head(mtcars))
```
(我不知道它的问题,但我的数据表是在shiny
应用程序中创建其实理想的情况下,我也希望有简单地倒入的分段表。脚本...但我切换策略,现在尝试使表直接在代码)
如果你是谁在渲染表灵活,有[其他表选项(HTTP:/ /rmarkdown.rstudio.com/lesson-7.html)for R Markdown like'knitr :: kable'。 –
@AdamSpannbauer感谢您的回答。我想我可能确实必须切换到kable ..但我宁愿不这样做,因为整个代码库(来自Shiny应用程序)都是使用DT :: datatables编写的。 – hartmut
你不能在'pdf_document'中使用'datatable'('datatable'是交互式的),只能在'html_document'中使用! PDF的唯一可能性是使用'kable'或者例如'pandoc.table' –