我有一个包含经度和纬度的数据集,我正在使用传单来显示它们。我正在使用传单clusterOptions = markerClusterOptions()
。我想将这些聚类作为标签保存在数据集中的新列中,以便查看哪些数据点聚在一起。
这可能吗?如果是这样,怎么办?
pp_leaflet_spatial_1 <- leaflet(First) %>%
addProviderTiles("CartoDB.Positron", group = "default") %>%
setView(lng = -73.97125, lat = 40.78306, zoom = 11) %>% # geocode("manhattan, NY")
addPolygons(data = nyc_neighborhoods, weight = 2, opacity = 1, color = "black", dashArray = "1", fillOpacity = 0.7,
highlight = highlightOptions(weight = 2, dashArray = "", color = "white",
fillOpacity = 0.7, bringToFront = TRUE),
label = ~neighborhood, labelOptions = labelOptions(style = list(
"font-weight" = "normal", padding = "3px 8px"), textsize = "15px", direction = "auto"))%>%
addCircleMarkers( ~pickup_longitude, ~pickup_latitude, radius = 5, fill = TRUE, color = "red",
opacity = 0.8, options = popupOptions(closeButton = TRUE),
clusterOptions = markerClusterOptions())
pp_leaflet_spatial_1
library(htmlwidgets)
saveWidget(pp_leaflet_spatial_1, file="C:/Users/CakeBox/Desktop/Taxi 2014/Maxime/cluster map.html")