har*_*mut 5 html datatable r r-markdown dt
如何DT::datatable将rmarkdown脚本中的对象显示到pdf文档上?到目前为止,我的代码已分解为以下错误:
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.
Run Code Online (Sandbox Code Playgroud)
always_allow_html: yes在YAML标头中包含可消除该错误,但pdf上没有任何内容。
我将不胜感激。我的代码当前为:
---
title: "DT"
output: pdf_document
---
### Chart 1
```{r}
DT::datatable(head(mtcars))
```
Run Code Online (Sandbox Code Playgroud)
(我不知道这是否重要,但是我的数据表实际上是在shiny应用程序中创建的。理想情况下,我希望将预渲染的表简单地转储到rmarkdown脚本中...但是我切换了策略,现在尝试渲染表直接在rmarkdown代码中)
从 knitr v1.13 开始,HTML 小部件将自动呈现为通过 webshot 包截取的屏幕截图。
你需要安装 webshot 包和 PhantomJS:
install.packages("webshot")
webshot::install_phantomjs()
Run Code Online (Sandbox Code Playgroud)
(见https://bookdown.org/yihui/bookdown/html-widgets.html)