I have a data frame as follows
d <- data.frame(number = 1:4,
date = c(1600, 1700, 1800, 1900),
T_name = c("name1", "name2", "name3", "name4"))
I've been trying to get my map to react to a select input but it's not working. The below code loads the app with the appropriate drop down lists, the map appears, but when I select something from the list the leaflet map does not react.
Can anyone see where I might be going wrong here?
UI code
library(shiny)
library(leaflet)
ui <- fluidPage("name_of_map",
sidebarLayout(
sidebarPanel(
selectInput(inputId = "input1", label = "Name of Filter" ,choices =
unique(d$T_name)),
selectizeInput(inputId = "year", label = "Year of Event",
choices = unique(d$date))
),
mainPanel(
leafletOutput("mymap"))
)
)
server code
server <- function(input, output) {
output$mymap <- renderLeaflet({
leaflet(data = d[1:25,]) %>% addTiles() %>%
addProviderTiles(providers$Esri.NatGeoWorldMap) %>%
addMarkers(lng=~longitude, lat=~latitude,
popup = ~paste(mname, "<br>", "Date:", date,
"<br>", "Number of casualties:",
casualties,"<a href=",d$web,">",d$web, main=input$input1)
)
})
}
reactive <- reactive({d})
shinyApp(ui, server)