【发布时间】:2021-02-04 19:03:25
【问题描述】:
在我的Rmarkdownfile 中,我想将我的.rmd 下载为html 文件,但出现以下错误。
警告:文件错误。无法打开连接。
我认为这是因为 source(...) 包含的外部文件,但我不知道为什么。在外部文件中,我连接到一个数据库。
---
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
runtime: shiny
---
```{r setup, include=FALSE}
library(flexdashboard)
library(rmarkdown)
source('R/load_data.R')
```
```{r}
output$export_btn<- downloadHandler(
filename = "report.html",
content = function(file) {
tempReport <- file.path(tempdir(), "test.Rmd")
file.copy("test.Rmd", tempReport, overwrite = TRUE)
out<-render(tempReport, html_document())
file.rename(out,file)
}
)
```
【问题讨论】:
标签: r shiny r-markdown flexdashboard