I am wondering if it is possible for clusterMarkers in leaflet to display frequency information instead of the number of markers clustered?
I have the following code
getColor <- function(my.df) {
sapply(my.df$value, function(value) {
if(value <= 5) {
"green"
} else if(value <= 25) {
"orange"
} else {
"red"
} })
}
icons <- awesomeIcons(
icon = 'ios-close',
iconColor = 'black',
library = 'ion',
markerColor = getColor(my.df)
)
map <- my.df %>%
leaflet () %>%
addTiles() %>%
addAwesomeMarkers(icon=icons, label=~as.character(freq), clusterOptions = markerClusterOptions())
map
my.df is in the following format
longitude latitude freq
XX.xxx XX.xxx 3
XX.xxx XX.xxx 7
XX.xxx XX.xxx 4
.
.
.
XX.xxx XX.xxx 6
What I would like is for the cluster to display the aggregate of the value for my.df$freq rather than the number of pins in the cluster. I am not sure how to do this though or if there is even a clusterOption for this.