score:5

Accepted answer

The answer turned out to be in the webshot package. @hrbrmstr provided the following code, which would be run at the end of the code I posted in the question:

# If necessary
install.packages("webshot")
library(webshot)
install_phantomjs()

# Main code
myChart$save("/tmp/rcharts.html")
webshot::webshot("/tmp/rcharts.html", file="/tmp/out.png", delay=2)

This saves the plot to the folder as an html, and then takes a picture of it, which is saved as a png.

I can then run the ReporteRs workflow by using addImage(mydoc, "/tmp/out.png").


Related Query

More Query from same tag