I am attempting to create a map within Shiny R, with leaflet. I have some clear lack of comprehension on how to engineer my Shiny R leaflet map. Here are my 2 issues:
-
How to create the map by selecting Symptoms by Country? as you can see data contains countries and symptoms in rows (see link on GitHub provided bellow). if I want to filter by a certain country and certain symptom how do I do this with leaflet in Shiny r?
-
How do I keep it interactive on Shiny R as I have it in Rmarkdown file?
Here is the code:
library(shiny) library(cvindia) library(tidyverse) library(shinydashboard) server = function(input, output, session){} ui <- fluidPage( # Application title h1("Symptoms accross the world"), # Sidebar with a slider input for number of bins selectInput("productCategory", "Select Country", c( "Bangladesh", "India", "Nigeria", "Pakistan", "United Kingdom")), selectInput("productCategory", "Symptom", c("Chills", "Cough", "Muscle Ache")) ) server <- function(input, output) { } # Run the application shinyApp(ui = ui, server = server)
If the above code is run, then I have easily managed to create the selectInput by country and symptom. yet, do not understand how to facilitate the drop down selection for example: India with symptoms mapping such as chills. Where in the server code facilitate the filtering and how? I am very new to shiny r and honestly the language used is hardly understood by a lay person like me.
Here is the second leaflet map code I have which I do not understand how should be engineered as I want to select by country and symptom.
leaflet() %>% addTiles() map <- leaflet(gather_divided) %>% addTiles() %>% addMarkers(clusterOptions = markerClusterOptions()) map
Sample of a dataset is on my GitHub as I haven't found a more elegant way of deploying it to stack overflow: