## Not run:
# # prepare data
# dat <- system.file(package="leafletR", "files", "park_sk.geojson")
#
# # simple categorizing
# sty <- styleCat(prop="lynx", val=c("yes", "no"),
# style.val=c("green", "red"), leg="Lynx occurrence")
# map <- leaflet(data=dat, dest=tempdir(), title="Lynx",
# style=sty)
#
# # just one category
# sty <- styleCat(prop="wisent", val="yes", style.val="red",
# leg="Wisent occurrence")
# map <- leaflet(data=dat, dest=tempdir(), title="Wisent",
# style=sty)
#
# # get nice colors using ColorBrewer
# require(RColorBrewer)
# pal <- brewer.pal(7, "Dark2")
# sty <- styleCat(prop="year", val=c("1949", "1967", "1978", "1988",
# "1997", "1998", "2002"), style.val=pal, leg="established:\n")
# map <- leaflet(data=dat, dest=tempdir(),
# title="National parks", style=sty)
#
# # add 'other'-category to legend
# require(RColorBrewer)
# pal <- brewer.pal(7, "Dark2")
# sty <- styleCat(prop="year", val=c("1997", "1998", "2002"),
# style.val=pal, leg="established:\n")
# map <- leaflet(data=dat, dest=tempdir(),
# title="National parks", style=sty)
#
# # additional styling parameters
# sty <- styleCat(prop="brown_bear", val=c("yes", "no"),
# style.val=c("darkgreen", "red"), leg="Brown bear\noccurrence",
# alpha=1, lwd=4, fill=NA)
# map <- leaflet(data=dat, dest=tempdir(), title="Brown bear",
# style=sty)
# ## End(Not run)
Run the code above in your browser using DataLab