The webshot package makes it easy to take screenshots of web pages from R. It requires an installation of the external program PhantomJS (you may use webshot::install_phantomjs() to install PhantomJS, if you do not want to download the binary and put it in PATH manually).

The main function in this package is webshot(). Below are some examples of taking screenshots of the website http://rstudio.github.io/leaflet/:

library(webshot)
URL <- "http://rstudio.github.io/leaflet/"
# Might need a longer delay for all assets to display
webshot(URL, delay = 0.5)