Rmarkdown : embed html file to ioslides

3.1k views Asked by At

I produce interactive plots with plotly, and save them as html pages. I'm new to ioslides and Rmarkdown, so I searched through the internet, and found no solution. I want to include a plotly graph with .html extension to my slide. So I tried:

---
title: "Advanced Physics Project"
author: "mcandar"
output: 
  ioslides_presentation:
    widescreen: true
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```

## Introduction
![my graph](myfile.html)

enter image description here

and it does not work. What I want is a slide with my html graph embedded inside and its interactive features should work properly. Is it possible?

1

There are 1 answers

2
Martin Schmelzer On BEST ANSWER

Option 1: Use an iframe:

---
title: "Advanced Physics Project"
author: "mcandar"
output: 
  ioslides_presentation:
    widescreen: true
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```

<iframe src="myfile.html"></iframe>

Option 2: includeHTML

```{r}
shiny::includeHTML("myfile.html") 
```

enter image description here