Shiny selecting ranges and numeric variable (as inputs) with leaflet
Shiny selecting ranges and numeric variable (as inputs) with leaflet On shiny, I would like to show a list of numerical variables and a slide bar so that a user could choose a numerical variable and a range. Then, observations below that number would show up as green, and observations between that range would be orange, and observations above that range would be red. The codes below work fine before I put them into shiny. But my shiny codes don't work and all observations are red. library(Rcpp) library(ggmap) library(htmlwidgets) library(leaflet) crime2 <- crime[1:50,] getColor <- function(crime2) { sapply(crime2$hour, function(hour) { if(hour< 1) { "green" } else if(hour <= 1) { "orange" } else { "red" } }) } icons <- awesomeIcons( icon = 'ios-close', iconColor = 'black', library = 'ion', markerColor = getColor(crime2) ) leaflet(crime2) %>% addTiles() %>% addAwesomeMarkers(~lon, ~...
