Relative Content

Tag Archive for javascriptarraysfor-looparraylistr-leaflet

Ho to make markers have different colors base on specific variable in R using leaflet?

start_stations <- data.frame( station = c(“StreeterDr”, “MichiganAve”, “WellsSt”, “Highwayzone”), lat = c(25.27091982, 25.28078061, 25.2842742,25.28212071), lng = c(51.53083782,51.51318414,51.50223763,51.54843926), status = c(“high”, “medium”, “low”, “extreme_low”), status_code = c(1, 2, 3, 4) ) library(leaflet) library(leaflet.extras) long <- as.integer(start_stations$lng) lat <-as.integer(start_stations$lat)station_name <- start_stations$station color_satus <- start_stations$status status_code <- start_stations$status_code data_station <- as.data.frame(cbind(long,lat,station_name,color_satus, status_code)) pal <- colorFactor( palette = c(“#5F11A3″,”#FF1300″,”#0F0065”, […]