Error to generate map using leaflet package

I would like to generate a map using leaflet from the two databases below.


 df<-structure(list(Properties = c(1,2), 
                     Latitude = c(-24.930473, -24.95575), 
                     Longitude = c(-49.994889, -49.990162), 
                     Waste = c(526,350),cluster = c(1,2)), class = "data.frame", row.names = c(NA, -2L))
  df1<-structure(list(Latitude = c(-24.924361,-24.95575), 
                       Longitude = c(-50.004343, -50.007371), 
                       cluster = c(1,2)), class = "data.frame", row.names = c(NA, -2L))

#Color and Icon for map
  ai_colors <-c("red","gray","blue")
  clust_colors <- ai_colors[df$cluster]
  icons <- awesomeIcons(
    icon = 'ios-close',
    iconColor = 'black',
    library = 'ion',
    markerColor =  clust_colors)

 m1<-leaflet(df1) %>% addTiles() %>%
     addMarkers(~Longitude, ~Latitude) %>%
    addAwesomeMarkers(lat=~df$Latitude, lng = ~df$Longitude, icon=icons, label=~as.character(df$Properties)) %>% 
    addLegend( position = "topright", title="Cluster", colors = ai_colors[1:max(df$cluster)],labels = unique(df$cluster))

However, it does not show the coordinates of the database df1

enter image description here

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.