I am using RStudio to create some some leaflet images.
I would like to be able to save the output as an HTML so that it can be emailed and others can view it.
Below is some sample R code which was taken from [here] to create a sample leaflet image.
devtools::install_github('rstudio/leaflet') library(leaflet) rand_lng = function(n = 10) rnorm(n, -93.65, .01) rand_lat = function(n = 10) rnorm(n, 42.0285, .01) m = leaflet() %>% addTiles() %>% addCircles(rand_lng(50), rand_lat(50), radius = runif(50, 10, 200)) m
Any code to be able to the output as HTML would be much appreciated...
Yes, you can save leaflet objects as images. In the viewer tab, above the map, you will find an export button to save leaflets as an image.
Something like:
library(htmlwidgets) saveWidget(m, file="m.html")
seems to work on most widgets.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With