Let\'s say I have a code like this
# Install devtools if needed
if(!require(devtools)) install.packages(\"devtools\")
# view rawif-devtools.R hosted with ❤ b
When I try to install a package named "leaflet", the dialog with CRAN only shows a package named leafletR
. Installing and loading that package does succeed with a message to the console:
Your leaflet map has been saved under /Users/myuser_name/map/map.html
And that map has the desired functionality. Given the amount of information that I can access from the web browser, I'm guessing that I'm actually interfaced through Chrome to an OpenStreetMap server rather than interacting with a disk file data service.
There is no addTiles function in the version downloaded from CRAN. And using sos::findFn does not find it in any other package. This could be a new function only available in the github version: https://github.com/chgrl/leafletR
Further searching shows this to be only hosted on RStudio and not on CRAN: http://robinlovelace.net/r/2015/02/01/leaflet-r-package.html
I needed a fresh session since I was getting error that I suspected were cause by having both leaflet and leafletR loaded at the same time. In my browser I left-clicked to bring up a ViewSource window and then selected and copy below. Both Chrome and Firefox have the capacity to display the underlying code and support selection and copying to an editor.
The code alone is not enough. The rest of the required support files will be saved in a directory with the same name as the html file and the browser "Save As ..." function is best for that: