2016-12-20 58 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

可能是路徑問題?無論如何,很高興它解決了... –