Here is a quick how-to on using Leaflet and RStudio. 

I was recently at the FOSS4G conference in Boston and was introduced to Shiny and the use of that server side tool to publish interactive applications powered by R. The specific example was a map with some statistics that were calculated based on your selections. 

I use QGIS quite a bit when doing any ad-hoc geospatial work and to deliver interactive maps in Leaflet and OpenLayers to clients. I wanted to try out RStudio and the Leaflet integration to increase the ability to build a more custom web map applications.

Here are the steps that I needed to take in order to get it running on my Rstudio using a MacBook Pro. 

1. Update your RStudio (I am running Pumpkin Helmet)

2. You then need to install Leaflet from Github using the devtools package

install.packages("devtools") devtools::install_github("rstudio/crosstalk") --Leaflet needs crosstalk so install it first devtools::install_github("rstudio/leaflet")

3. Now you can make a map

m <- leaflet() %>% setView(lng = -71.0589, lat = 42.3601, zoom = 12) >
addTiles(m) 

4. This is how you swap out basemaps to show some of the other functionality. There are a lot of available providers that will show up in the dropdown once you type providers$

m %>% addProviderTiles(providers$OpenStreetMap.Mapnik)  
m %>% addProviderTiles(providers$Thunderforest.Transport)  
m %>% addProviderTiles(providers$Stamen.Toner)

Try this out and let me know if you have any questions. 

-Nate