Skip to content

Instantly share code, notes, and snippets.

@mrjoh3
Created November 3, 2018 03:10
Show Gist options
  • Save mrjoh3/b949ce649b12625337d700c63588ba70 to your computer and use it in GitHub Desktop.
Save mrjoh3/b949ce649b12625337d700c63588ba70 to your computer and use it in GitHub Desktop.
Webshot will automatically render web content for non-web formats such as PDF
---
title: "Untitled"
output:
rmarkdown::github_document:
html_preview: true
html_document: default
pdf_document: default
always_allow_html: yes
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Variable Formats
First install `webshot` and ensure `rmarkdown` and `knitr` are up to date. Add a `htmlwidget` and then `knit` to the file type of your choice. Formatting options can be set for each file type in the `YAML` header.
```r
install.packages("webshot")
webshot::install_phantomjs()
```
```{r widget}
library(c3)
data <- data.frame(a = abs(rnorm(20) * 10),
b = abs(rnorm(20) * 10),
date = seq(as.Date("2014-01-01"), by = "month", length.out = 20))
c3(data)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment