我想从一个特定的位置添加折线到其他许多闪亮 [R使用addPolylines的传单.但是,不是从一个位置链接到另一个位置,我只能按顺序将它们全部链接在一起.在板球车轮图中可以看到我想要实现的最好的例子:
.
observe({
long.path <- c(-73.993438700, (locations$Long[1:9]))
lat.path <- c(40.750545000, (locations$Lat[1:9]))
proxy <- leafletProxy("map", data = locations)
if (input$paths) {
proxy %>% addPolylines(lng = long.path, lat = lat.path, weight = 3, fillOpacity = 0.5,
layerId = ~locations, color = "red")
}
})
Run Code Online (Sandbox Code Playgroud)
它是一个反应式表达式,因为我希望它们被一个复选框激活.
我真的很感激任何帮助!