Dynamically update arcs with Shiny.

update_arcs(proxy, origin.lon, origin.lat, destination.lon, destination.lat,
  ...)

update_arcs_name(proxy, origin, destination, ...)

Arguments

proxy

a proxy as returned by datamapsProxy.

origin.lon

origin coordinates.

origin.lat

origin coordinates.

destination.lon

destination coordinates.

destination.lat

destination coordinates.

...

any other arguments to use as options.

origin

edges.

destination

edges.

Examples

# NOT RUN {
library(shiny)

ui <- fluidPage(

  textInput(
    "from",
    "Origin",
    value = "USA"
  ),
  textInput(
    "to",
    "Destination",
    value = "RUS"
  ),
  actionButton(
    "submit",
    "Draw arc"
  ),
  datamapsOutput("map")
)

server <- function(input, output){

  arc <- reactive({
    data.frame(from = input$from, to = input$to)
  })

 output$map <- renderDatamaps({
   datamaps()
 })

 observeEvent(input$submit, {
   datamapsProxy("map") %>%
     add_data(arc()) %>%
     update_arcs_name(from, to)
 })

}

shinyApp(ui, server)
# }