leaflet icon indicating copy to clipboard operation
leaflet copied to clipboard

What is the difference to other leaflet-R packages?

Open Make42 opened this issue 11 years ago • 4 comments

There exist (at least) two other R-packages for leaflet:

https://github.com/jcheng5/leaflet-shiny https://github.com/chgrl/leafletR

What is the difference to this package, and when and why should I use which one?

Make42 avatar Mar 24 '15 12:03 Make42

jcheng5/leaflet-shiny was something I originally threw together as an example for a talk I was giving, and people started using it in their own projects.

  • It can only be used with Shiny.
  • It is a very "imperative" API, which is good if you want to render the map and then manipulate parts of it in response to user actions or other reactive kinds of stuff.
  • It is relatively poorly documented.

rstudio/leaflet is a more deliberate attempt to provide a production quality Leaflet package for a variety of uses in R.

  • It works well from the R console but also integrates nicely with RStudio, Shiny, and R Markdown. This is thanks to the htmlwidgets package.
  • It is currently a "declarative" API, which is good for the initial rendering of a map but not so good for manipulating a map that already exists. We'll add an imperative-style API in a future release, so you'll have the best of both worlds.
  • Much more convenient to add layers based on data frames, sp data structures, maps package, etc. Basically a modern, %>%-oriented API with heavy input from @hadley.
  • Includes a nice set of functions for color scaling (but sadly not legends yet!).
  • Fully documented.

I don't know much about chgrl/leafletR. It's not based on htmlwidgets so I would assume it doesn't work with Shiny or R Markdown. Other than that, I don't know--perhaps @chgrl can weigh in.

I believe @ramnathv also has not one but two Leaflet bindings, in ramnathv/rCharts and ramnathv/rMaps. I think at least one of these has a high level function specifically for generating choropleths. This was a pretty big advantage over jcheng5/leaflet-shiny, but the advantage vs. rstudio/leaflet is much narrower IMHO since mapping data to colored polygons is so easy in the new package.

I hope that helps somewhat. I'm going to close this as an issue, but if anyone else has experience with more than one of these libraries, feel free to weigh in.

jcheng5 avatar Mar 25 '15 05:03 jcheng5

hello everyone, My name is Myriam and I live in tunisia   currently doing my research paper for devolloper an application with Longage R and shiny framework for the first step I have some questions to help me move I have written class R & I'll tcl tk convert to shiny but I do not know how to do to convert so I really would like you to help me to solve this problem and thank you in advance :)

mariemhammami avatar Mar 26 '15 15:03 mariemhammami

First of all, you should open a new thread. I am not sure, whether there is an alternative at github to openning a new "issue". If not, you might wanne consider to open a new issue or open a new topic at stackoverflow.com

Secondly you should explain a little more: What is "Longage R" and what does " I'll tcl tk" mean?

Thirdly: What is your SPECIFIC question? You should asked for help in general... It will be difficult for anyone to answer that ;-).

Make42 avatar Mar 26 '15 16:03 Make42

@mariemhammami + you might want to spell your name just one way

pssguy avatar Mar 26 '15 16:03 pssguy