Skip to content

Instantly share code, notes, and snippets.

@stephlocke
Created July 12, 2018 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stephlocke/1bc4b2403978abc11596395200007eb1 to your computer and use it in GitHub Desktop.
Save stephlocke/1bc4b2403978abc11596395200007eb1 to your computer and use it in GitHub Desktop.
Example of trying to get an iframe of a html widget
---
title: "sample"
output:
md_document:
variant: markdown_github
preserve_yaml: true
always_allow_html: yes
---
```{r setup, include = FALSE, message = FALSE, warning = FALSE, error = FALSE}
library(knitr)
library(htmlwidgets)
library(widgetframe)
opts_chunk$set(collapse = TRUE)
if(!require(outbreaks)) install.packages(outbreaks)
if(!require(epicontacts)) install.packages(epicontacts)
```
```{r}
library(epicontacts)
library(outbreaks)
merskor15 <- make_epicontacts(linelist = mers_korea_2015$linelist,
contacts = mers_korea_2015$contacts,
directed = FALSE)
```
```{r}
p=plot(merskor15)
```
```{r echo=FALSE}
saveWidget(p, "htmlwidget.html", selfcontained = TRUE)
```
<iframe src="htmlwidget.html" width="100%" height="500px"></iframe>
```{r echo=FALSE}
frameWidget(p)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment