## Not run:
# # prepare data
# data(quakes)
# dat <- toGeoJSON(data=quakes, dest=tempdir())
#
# # create and view simple map
# map <- leaflet(dat, dest=tempdir())
# map # redirects to browseURL(map)
#
# # set output directory and map title
# map <- leaflet(data=dat, dest=tempdir(), title="Fiji Earthquakes")
#
# # set map size, center and zoom level
# map <- leaflet(data=dat, dest=tempdir(),
# size=c(800,600), center=c(-18.35, 179.75), zoom=6)
#
# # set base map and popup/label
# # magnitude is used as popup (type names(quakes) for available properties)
# map <- leaflet(data=dat, dest=tempdir(),
# base.map="mqsat", popup="stations", label="mag")
#
# # minimalist? - no base map
# map <- leaflet(data=dat, dest=tempdir(),
# base.map=NA, popup="mag")
#
# # include data in HTML file
# map <- leaflet(dat, dest=tempdir(), incl.data=TRUE)
#
# # preserve existing files from overwriting
# map <- leaflet(dat, dest=tempdir(), overwrite=FALSE)
#
# # more than one base map
# map <- leaflet(data=dat, dest=tempdir(),
# base.map=list("osm", "mqsat", "tls"))
#
# # multiple properties in the popup
# map <- leaflet(data=dat, dest=tempdir(),
# popup=c("mag", "depth"))
#
# # all available properties in the popup
# map <- leaflet(data=dat, dest=tempdir(),
# popup="*")
#
# # change style
# sty <- styleSingle(col="red", fill=NA)
# map <- leaflet(data=dat, dest=tempdir(), base.map="mqsat", style=sty)
#
# # controls
# map <- leaflet(data=dat, dest=tempdir(), controls=NA) # no controls
# map <- leaflet(data=dat, dest=tempdir(), controls="scale") # scale only
# map <- leaflet(data=dat, dest=tempdir(), controls=c("zoom", "scale"))
#
# # more than one data set
# park <- system.file(package="leafletR", "files", "park_sk.geojson")
# peak <- toGeoJSON(system.file(package="leafletR", "files", "peak_sk.kmz"),
# dest=tempdir()) # httr package required
# sty.1 <- styleSingle(col="green", fill="green")
# sty.2 <- styleSingle(col="brown", fill="brown", rad=3)
# map <- leaflet(data=list(park, peak), dest=tempdir(),
# style=list(sty.1, sty.2), popup=list("*", "Name"))
#
# # names in legend
# # note: "_" and "." are replaced with blanks in the legend
# map <- leaflet(data=list(National_Parks=park, Peaks.above.600.m)=peak),
# dest=tempdir(), style=list(sty.1, sty.2), popup=list("*", "Name"))
# ## End(Not run)
Run the code above in your browser using DataLab