2016-12-20 57 views
1

我用阴谋制作交互式图表,并将它们保存为html页面。我是新来的ioslides和Rmarkdown,所以我通过互联网搜索,没有找到解决办法。我想在幻灯片中添加一个带有.html扩展名的阴谋图。所以,我想:Rmarkdown:将html文件嵌入到ioslides中

--- 
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图形,它的交互功能应该可以正常工作。可能吗?

+0

我可能是错的,但plotly可能只在基于HTML的被列入R Markdown格式。 – MLavoie

回答

1

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

+0

感谢您的回答! unfornately它没有为我工作,也许我做错了什么..但闪亮:: includeHTML(“myfile.html”)工作! – mccandar

+0

可能是路径问题?无论如何,很高兴它解决了... –