Enrique Figueroa Navarro
02/10/2021
First, the df is filtered to determine the date range in a reactive function.
filteredData = reactive({universities[universities$founded >= input$range[1] & universities$founded <= input$range[2],] })
The map is rendered via a leaflet instruction:
output$map = renderLeaflet({ leaflet(universities) %>% addTiles() %>% fitBounds(~min(long), ~min(lat), ~max(long), ~max(lat)) })
Finally, an observe instruction is used to show changes to the slider:
observe({ leafletProxy(“map”, data = filteredData()) %>% clearShapes() %>% addCircles(radius = ~104/60, weight = 12, color = “blue”, # WORKING fillOpacity = 0.1, popup = ~paste(universities$university) ) })
Basic instructions are displayed at he bottom of the app:
Some Peruvian universities geolocations are shown as a blue circle, according to the date when they were founded.
Clicking on any of the blue circles displays the name of the university.
The slider allows to filter the universities. Also, the date range of the slider is mirrored in a texbox.
Complete code can be found at: