# If want list
providers <- providers
#3 from http://rpubs.com/bhaskarvk/leaflet-providers
m <- leaflet() %>% setView(lng=-80,lat=40,zoom=5) %>% # nothing showing until we set providers
addProviderTiles(providers$CartoDB.Positron)
# Take out ESRI provided tiles - leaves the 11 esri ones there
esri <- providers %>% #List of all providers with their variations https://github.com/leaflet-extras/leaflet-providers/blob/master/leaflet-providers.js
purrr::keep(~ grepl('^Esri',.)) ## similar to filter
esri %>%
purrr::walk(function(x) m <<- m %>% addProviderTiles(x,group=x)) #walk Apply a function to each element of a vector ## not sure what this does though
## this produces a nice set of options stacked in top-right corner
m %>%
addLayersControl(
baseGroups = names(esri),
options = layersControlOptions(collapsed = TRUE)
)