knitr::opts_chunk$set(echo = TRUE)
suppressPackageStartupMessages( require(tidyverse) )
suppressPackageStartupMessages( require(webshot) )
suppressPackageStartupMessages( require(rmarkdown) )

Here we want to try out the webshot package in order to integrate htmlwidgets rendered as .png or similar into .Rmd documents.

Render Plotly normally

p = ggplot(mtcars, aes(disp, mpg) ) +
  geom_point()

plotly::ggplotly(p)

Render as png using chunk option screenshot.force = TRUE

p = ggplot(mtcars, aes(disp, mpg) ) +
  geom_point()

plotly::ggplotly(p)

Render another .Rmd with webshot

we will use example_ggpubr.Rmd

file_path = file.path( system.file(package = 'oetteR')
                                   , 'POC_Rmd'
                                   , 'POC_ggpubr.Rmd')

rmdshot( file_path  )

file.remove('webshot.png')


erblast/oetteR documentation built on May 27, 2019, 12:11 p.m.