如何在Rmarkdown文件中包含DiagrammeR /美人鱼流程图

时间:2016-11-25 10:39:35

标签: r r-markdown diagrammer mermaid

我有一个R降价文件:

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

以及DiagrammeR /美人鱼图表:

graph LR
    A-->B

如何在R-markdown中添加图表?

1 个答案:

答案 0 :(得分:4)

实际上这很简单:

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
")
```