Hey,
Give conditions for color or radius within addCircleMarkers as below.
Example -
For variable size
leaflet(df) %>% addTiles() %>%
addCircleMarkers(
radius = ~ifelse(field > 50, 6, 10),
)
For variable color-
Create a function to decide the color
func = colorNumeric(c("green","yellow","red"), domain = NULL)
or
func = colorNumeric(c("green","yellow","red"), domain = NULL,bins = 3)
call the function as below.
leaflet(df) %>% addTiles() %>%
addCircleMarkers(
color = func(sort(~field))
)
Hope it helps!