m <- mapview(breweries)
## create standalone .html
mapshot(m, url = paste0(getwd(), "/map.html"))
## create standalone .png; temporary .html is removed automatically unless
## 'remove_url = FALSE' is specified
mapshot(m, file = paste0(getwd(), "/map.png"))
## create .html and .png
mapshot(m, url = paste0(getwd(), "/map.html"),
file = paste0(getwd(), "/map.png"))
Run the code above in your browser using DataLab