When I try to install a package named leaflet, the CRAN dialog only shows a package named leafletR . Installing and downloading this package is performed with a message to the console:
Your leaflet map has been saved under /Users/myuser_name/map/map.html
And this card has the desired functionality. Given the amount of information that I can get in a web browser, I assume that I actually interact with Chrome on the OpenStreetMap server, and not interact with the data transfer service on disk.
In the version downloaded from CRAN, there is no addTiles function. And using sos :: findFn does not find it in any other package. This may be a new feature available only in the github version: https://github.com/chgrl/leafletR
A further search shows that this placement is only on RStudio, and not on CRAN: http://robinlovelace.net/r/2015/02/01/leaflet-r-package.html
I needed a new session, because I was getting an error, which, as I suspected, was caused by the fact that both leaflets and leaflets were loading at the same time. In my browser, I left-clicked to open the ViewSource window, and then select and copy below. Both Chrome and Firefox can display the base code and support selection and copying to the editor.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <script src="lib/htmlwidgets-0.3.2/htmlwidgets.js"></script> <script src="lib/jquery-1.11.1/jquery.min.js"></script> <link href="lib/leaflet-0.7.3/leaflet.css" rel="stylesheet" /> <script src="lib/leaflet-0.7.3/leaflet.js"></script> <link href="lib/leafletfix-1.0.0/leafletfix.css" rel="stylesheet" /> <script src="lib/leaflet-binding-0.0.16/leaflet.js"></script> </head> <body style="background-color:white;"> <div id="htmlwidget_container"> <div id="htmlwidget-3689" style="width:100%;height:400px;" class="leaflet"></div> </div> <script type="application/json" data-for="htmlwidget-3689">{ "x": { "calls": [ { "method": "addTiles", "args": [ "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", null, { "minZoom": 0, "maxZoom": 18, "maxNativeZoom": null, "tileSize": 256, "subdomains": "abc", "errorTileUrl": "", "tms": false, "continuousWorld": false, "noWrap": false, "zoomOffset": 0, "zoomReverse": false, "opacity": 1, "zIndex": null, "unloadInvisibleTiles": null, "updateWhenIdle": null, "detectRetina": false, "reuseTiles": false, "attribution": "© <a href=\"http://openstreetmap.org\">OpenStreetMap</a> contributors, <a href=\"http://creativecommons.org/licenses/by-sa/2.0/\">CC-BY-SA</a>" } ] } ] },"evals": [ ] }</script> <script type="application/htmlwidget-sizing" data-for="htmlwidget-3689">{ "viewer": { "width": "100%", "height": 400, "padding": 0, "fill": true },"browser": { "width": "100%", "height": 400, "padding": 0, "fill": true } }</script> </body> </html>
One code is not enough. The remaining necessary support files will be saved in the directory with the same name as the html file, and the "Save As ..." function for the browser is best suited:
