Shiny 我如何修改这个闪亮的应用程序示例,以便在地图上有条件地显示总线的颜色(取决于模型的输出)?
我试图了解闪亮的应用程序,尤其是位于 我想修改更新规则,以便根据位置$Bearing>=200来显示颜色 我试图修改位置数据框,该数据框具有方向性,但无法确定在更新传单地图时如何改变地图上的颜色。看起来它可能与颜色=~dirPal(方向)有关Shiny 我如何修改这个闪亮的应用程序示例,以便在地图上有条件地显示总线的颜色(取决于模型的输出)?,shiny,data-science,shinydashboard,cran,Shiny,Data Science,Shinydashboard,Cran,我试图了解闪亮的应用程序,尤其是位于 我想修改更新规则,以便根据位置$Bearing>=200来显示颜色 我试图修改位置数据框,该数据框具有方向性,但无法确定在更新传单地图时如何改变地图上的颜色。看起来它可能与颜色=~dirPal(方向)有关 addTiles('http://{s}.tile.thunderforest.com/transport/{z}/{x}/{y}.png')%>% addCircleMarkers( ~车辆长度, ~车辆高度, 颜色=~dirPal(方向), 不透明度
addTiles('http://{s}.tile.thunderforest.com/transport/{z}/{x}/{y}.png')%>%
addCircleMarkers(
~车辆长度,
~车辆高度,
颜色=~dirPal(方向),
不透明度=0.8,
半径=16
)```
其中dirColors是在脚本开头定义的
肮脏的
addTiles('http://{s}.tile.thunderforest.com/transport/{z}/{x}/{y}.png') %>%
addCircleMarkers(
~VehicleLongitude,
~VehicleLatitude,
color = ~dirPal(Direction),
opacity = 0.8,
radius = 16
)```
where dirColors is defined at beginning of script
dirColors <-c("1"="#595490", "2"="#527525", "3"="#A93F35", "4"="#BA48AA", "5" = "#BA48AA")
routeVehicleLocations <- reactive({
if (is.null(input$routeNum))
return()
locations <- vehicleLocations()
anomalies <- locations[locations$Bearing > 200,]
if (as.numeric(input$routeNum) == 0)
return(locations)
locations[locations$Route == input$routeNum, ]
})