I get to plot the location of properties on Google Maps. But as you can see I divided it into clusters. So, I need the points that were from the same clusters to have the same color. Can you help me?
Thank you very much!
library(googleway)
library(geosphere)
set_key( "API_KEY" )
swf1<-structure(list(Properties = c(1,2,3,4,5,6), Lat = c(-24.781624,-24.775017,-24.769196,-24.761741,-24.752019,-24.748008),
Lon = c(-49.937369,-49.950576,-49.927608,-49.92762,-49.920608,-49.927707)),
class="data.frame",row.names = c(NA, -6L))
#clusters
d<-as.dist(distm(swf1[,2:1]))
fit.average<-hclust(d,method="average")
clusters<-cutree(fit.average, 5)
swf1$cluster<-clusters
google_map() %>%
add_markers(
data = swf1, lon = "Lon", lat = "Lat")