Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include DiagrammeR/mermaid flowchart in a Rmarkdown file

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?

like image 978
Oneira Avatar asked Nov 25 '16 10:11

Oneira


1 Answers

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
")
```
like image 68
Oneira Avatar answered Sep 21 '22 18:09

Oneira