How to include DiagrammeR/mermaid flowchart in a Rmarkdown file

风格不统一 提交于 2020-01-02 07:24:40

问题


I have an R markdown file:

---
title: "Untitled"
author: "Me"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## R Markdown
This is an R Markdown document. 

As well as a DiagrammeR/mermaid chart:

graph LR
    A-->B

How can I add the chart in the R-markdown?


回答1:


Actually it is trivial:


title: "Untitled"
author: "Me"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## R Markdown
This is an R Markdown document. 

```{r}
library(DiagrammeR)
mermaid("
graph LR
    A-->B
")
```


来源:https://stackoverflow.com/questions/40803017/how-to-include-diagrammer-mermaid-flowchart-in-a-rmarkdown-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!