
Efficiently style a group that has already been added to the map
Source:R/utils.leaflet.R
setStyle.RdCall with a group and a vector of style lists of length N. The first N features of the group will be restyled.
Examples
# \donttest{
renderLeaflet('map', {
leaflet() |> addPolygons(data = zones, group = 'zones', color = 'red')
})
#> Error in eval(expr, envir, enclos): object 'zones' not found
colour <- 'blue'
styles <- lapply(pal(values), function(colour) {
list(fillColor = colour, color = colour)
})
#> Error in pal(values): could not find function "pal"
leafletProxy('map') |>
setStyle('zones', styles)
#> Error in setStyle(leafletProxy("map"), "zones", styles): could not find function "setStyle"
# }