Development of Shiny app for real time traffic monitoring

...Hello, so I'm currently working on the above topic. I have developed the basic ui and a part of the server but I have issues with creating the reactive and observe event. I want my map to show the condition of traffic flow in a selected route and day of the week based on the input of the user.
Below is my code
server <- function(input, output,session) {
updateSelectizeInput(session, "route", choices = m$name, server=TRUE)
selectedDay <- reactive({switch(input$Day,
pal <- colorNumeric(palette=c('Red', 'Blue', 'Orange'), domain=m$Traffic_Flow)

output$mymap <- renderLeaflet({
leaflet(m) %>%
addTiles() %>%
setView(lng = 3.29611, lat=6.61085,zoom=11) %>%
addPolygons(data=map,weight=5,col = 'black') %>%

observeEvent(input$Day, {
leafletProxy("m", data = selectedDay()) %>%
clearShapes() %>%
addPolylines(data = m, col = "red", weight=2)

and for the ui
ui <- fluidPage(
actionButton("update", "Update View"),
selectInput("Day", "Day of the week", c("Monday", "Wednesday", "Friday", "Saturday")),
selectInput("time", "Time of the day", c("Morning", "Evening")),
selectizeInput("route", "Route", choices="", multiple=FALSE, options = list(
placeholder = 'Please select a route from below')
leafletOutput("mymap",height = 1000)



I have my csv and shapefiles in my process.R


map <- readOGR("C:/Users/user/Desktop/LAGOS/Alimosho.shp")
map <- spTransform(map, CRS("+proj=longlat +ellps=GRS80"))
roads <- readOGR("C:/Users/user/Desktop/LAGOS/Major_Roads.shp")
roads <- spTransform(roads, CRS("+proj=longlat +ellps=GRS80"))
count <- read.csv("C:/Users/user/Desktop/LAGOS/TrafficCount.csv")
Tcount <- traffic[c(1:24),]
saveRDS(count, "C:/Users/user/Desktop/LAGOS/count.rds")
traffic <- read.csv("C:/Users/user/Desktop/LAGOS/traffic.csv")
m <- merge(roads, traffic, by='name')

This is what my map looks like after all that

Where am I missing it? What is missing?

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.