Rmarkdown:将html文件嵌入到ioslides中

时间:2016-12-20 07:25:04

标签: html r r-markdown plotly ioslides

我用plotly生成交互式图,并将它们保存为html页面。我是ioslides和Rmarkdown的新手,所以我在互联网上搜索,没有找到解决办法。我想在我的幻灯片中添加一个带有.html扩展名的图形图。所以我试过了:

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

它不起作用。我想要的是一张幻灯片,其中嵌入了我的html图表,其交互功能应该正常工作。有可能吗?

1 个答案:

答案 0 :(得分:4)

选项1:使用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>

选项2:includeHTML

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

enter image description here

相关问题