我目前正在尝试从闪亮的应用生成并导出pdf文件。 我使用kable生成一个表(它可以工作)。
当我向表中添加kable_styling选项时(kable_styling(latex_options = c(“scale_down”))),它无法生成我的pdf文件,并显示以下错误: 错误:pandoc文档转换失败,错误43
注意:我检查过我的pandoc版本是否已到期。
有什么想法吗? 非常感谢
这是我的input.rmd
---
title: ""
output: pdf_document
---
```{r echo=T}
library(kableExtra)
library(knitr)
dt <- mtcars[1:5, 1:4]
kable(cbind(dt,dt, dt, dt, dt), "markdown") %>%
kable_styling(latex_options = c("scale_down"))
kable(dt, format = "latex", booktabs = T, caption = "Demo Table") %>%
add_header_above(c(" ", "Group 1" = 2, "Group 2[note]" = 2)) %>%
add_footnote(c("table footnote"))
test3<-kable(dt, "markdown")
kable_styling(test3, font_size=14)
```
Tableau2
`r test3`
和闪亮的应用程序:
library(rmarkdown)
library(knitr)
shinyApp(
ui = fluidPage(
basicPage(
downloadButton('report'))
),
server = function(input, output) {
output$report = downloadHandler(
filename = 'myreport.pdf',
content = function(file) {
out = render('input.Rmd', clean = TRUE, encoding='utf-8')
file.rename(out, file) # move pdf to file for downloading
},
contentType = 'application/pdf'
)
}
)