I would like to display flow lines (OD-lines) using leaflet in Shiny and sofar I can successfully map all the lines I want. But I also want to change the line width so that each line will have a different linewidth depending on the attribute they have. I am trying to get the values for weight with the following code but it does not work:
values <- reactive({ test[quel==input$zelle&hr==input$std&vmitt==input$vmitt&tag==input$tag] })
observe({ anzhl <-isolate(values()[,10]) print(anzhl[1]*2) str(anzhl)
values <- reactive({
test[quel==input$zelle&hr==input$std&vmitt==input$vmitt&tag==input$tag]
})
observe({
anzhl <-isolate(values()[,10])
print(anzhl[1]*2)
str(anzhl)
leafletProxy("zones", data = values()) %>%
removeShape(layerId="liID") %>%
addPolylines(lng=~x_coor, lat=~y_coor, stroke=TRUE, layerId="liID", color="black", weight=sum(anzhl())/100)})
I get the following error message: Warning: Error in observerFunc: could not find function "anzhl" Stack trace (innermost first): 56: observerFunc [E:.../server.R#118] 1: runApp ERROR: [on_request_read] connection reset by peer
Warning: Error in observerFunc: could not find function "anzhl"
Stack trace (innermost first):
56: observerFunc [E:\.../server.R#118]
1: runApp
ERROR: [on_request_read] connection reset by peer
What am I doing wrong and is it ever possible to change the line widths with the values called within an interactive session.