在柔性仪表板中包含rmarkdown文本(includeMarkdown不起作用)(R)



我想包含外部markdown文件;然而,到目前为止,我无法在RStudio上处理它。如果我手动将about.md的内容复制/粘贴到main中。R、 没有问题。我的意思是,设置与flexdashboard相关的一切都很好。另一方面,我尝试重新安装rmarkdown包,并通过库("rmarkdown"(导入它。这还不够公平,因为flexdashboard已经有了内部的。因此,除了flexdashboard的安装之外,它不应该与是否安装了rmarkdown有关。有什么建议吗?感谢

我准备了最低限度的代码,其输出如下:"about.md">

test1
=======================================================================
**testttt**
testttt
**testttt2**
testttt

主.R

---
title: "test"
author: "test"
output: 
flexdashboard::flex_dashboard:
orientation: rows
social: menu
vertical_layout: fill
---
```{r setup, include=FALSE}
library(flexdashboard)
```
```{r}
includeMarkdown('about.md')
```

输出:

Quitting from lines 17-18 (minimal.Rmd) 
Error in includeMarkdown("about.md") : 
could not find function "includeMarkdown"
Calls: <Anonymous> ... handle -> withCallingHandlers -> withVisible -> eval -> eval
Execution halted

函数includemarkdown来自程序包htmltools。所以你必须加载库或使用:

```{r}
htmltools::includeMarkdown('about.md')
```

最新更新