mccandar
mccandar

Reputation: 778

Rmarkdown : embed html file to ioslides

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?

Upvotes: 5

Views: 3184

Answers (1)

Martin Schmelzer
Martin Schmelzer

Reputation: 23879

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

Upvotes: 8

Related Questions