Distributing confidential maps is hard
I’ve been trying, for a while now, to figure out how to use R to replace MapPoint–the challenge has been distributing a map of confidential data to non-R users in my office.
Making the maps isn’t THAT hard: leaflet makes it pretty easy to draw up a map and the ggmap library has the
geocode() function, so that’s solved too.
The real problem is, after I build a leaflet map of the VP’s prospects with giving and wealth rating data, how do I send it the VP’s admin assistant so she can work out his travel plans? I can’t put that kind of confidential data on Rpubs. Running and administering a shiny server (not to mention building a shiny app) is too much work for one-off stuff like this–I just want to be able to save the file and email it.
Turns out, the htmlwidgets library has a
saveWidget() function. I did something like this:
# make the map
mapfortheVP <- leaflet(prospects) %>%
addMarkers( popup = ~ name_and_giving )
# save it to my desktop
widget = mapfortheVP
, file = "~/Desktop/mapfortheVP.html"
, selfcontained = T
It still requires internet access to download the map (by default from Open Street Maps)–I’d like to get that sorted out later on so development officers can throw the html file in Dropbox and open it up when they’re on the road–but for now, using
saveWidget() seems to be the way to go!