I am trying to build an app in R Shiny which takes inputs from several different data sets and then maps them. My main problem is trying to get the colors to change based off of what data is selected. Currently in the UI I have a selectInput("color", "Color", color_variable_outside), with color_variable_outside being a list of several variables that in one, both or, neither data set.
I then try to run them through my map like this:
output$mymap <- renderLeaflet({
filteredData <- active_dataset()
print(paste("lat_lng class:", class(lat_lng)))
mymap <- leaflet(filteredData) %>%
addTiles() %>%
addCircleMarkers(
lat =~filteredData[[lat_lng()[1]]],
lng =~filteredData[[lat_lng()[2]]],
fillColor = ~colorFactor("viridis", domain =(length(unique(input$color)))),
stroke = FALSE, fillOpacity = 0.7 )
And nothing changes ever. It always stays black. I've tried a variety of other solutions but I just can'T seem to get it to work properly. I'd really love any help! Cheers!