The Leaflet JS mapping library has lots of plugins available. The Leaflet package for R provides direct support for some, but far from all, of these plugins, by providing R functions for invoking the plugins.
If you as an R user find yourself wanting to use a Leaflet plugin that isn't directly supported in the R package, you can use the technique shown here to load the plugin yourself and invoke it using JS code.
Wow, sorry, I didn't know there were so many messages posted here over the years. @Jigar-S, leaflet-measure is already bundled with the leaflet R package, just do
leaflet() %>% addMeasure()
for example.For the rest of you, I'd focus on the following for debugging:
htmlDependency
directly, they have to be compiled to .css first for the browser to understand them.) You can use Chrome Developer Tools to see if there are any errors in the Console tab about JS and CSS URLs not being downloaded, and look in the Elements tab to see if the proper JS/CSS links are in the<head>
of the document.debugger;
to the start of youronRender
function's JS function. Then, if you load the page with Chrome Developer Tools enabled, the JS debugger should pause just inside your JS function. With the debugger paused, you can examine the values ofthis
,el
,x
, etc. to see if everything matches your expectations.If you have continued problems, feel free to file an issue on the rstudio/leaflet repository, or drop by https://community.rstudio.com/c/shiny.