【问题标题】:Including rmarkdown text in flexdashboard (includeMarkdown does not work) (R)在 flexdashboard 中包含 rmarkdown 文本(includeMarkdown 不起作用)(R)
【发布时间】:2020-04-22 14:52:45
【问题描述】:

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

我准备了最少的代码,其输出如下: '关于.md'

test1
=======================================================================

**testttt**

testttt

**testttt2**

testttt

main.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

【问题讨论】:

    标签: r r-markdown flexdashboard r-library


    【解决方案1】:

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

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

    【讨论】:

    • 它确实从文件中获取了降价细节,但它没有捕获 about.md 中的内联代码。你对此有什么想法吗?
    猜你喜欢
    • 1970-01-01
    • 2020-04-26
    • 2019-12-27
    • 1970-01-01
    • 1970-01-01
    • 2018-09-11
    • 2021-08-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多