Oneira
Oneira

Reputation: 1445

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?

Upvotes: 11

Views: 8769

Answers (1)

Oneira
Oneira

Reputation: 1445

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

Upvotes: 12

Related Questions