R 在selectInput小部件下拉选项上添加彩色点

R 在selectInput小部件下拉选项上添加彩色点,r,shiny,shinywidgets,R,Shiny,Shinywidgets,我有一个selectInput小部件,可以选择多个输入。我想在每个选择选项上添加一个小的彩色点,以便将其作为基于输入生成的相应绘图的图例 selectInput("selectedSensors", "Select Climatic Condition(s) :", choices = c("Temperature" = "5a", "Re

我有一个selectInput小部件,可以选择多个输入。我想在每个选择选项上添加一个小的彩色点,以便将其作为基于输入生成的相应绘图的图例

selectInput("selectedSensors", "Select Climatic Condition(s) :",
                choices = c("Temperature" = "5a",
                  "Relative Humidity" = "5b",
                  "Pressure" = "5c",
                  "Mass Density of Particles in air (diam < 2.5μm)" = "0a",
                  "Mass Density of Particles in air (diam < 10μm)" = "0b",
                  "Wind Speed" = "6"), multiple = TRUE,
                selected = c("5b", "5a", "6"))
selectInput(“selectedSensors”,“selectclimate Condition:”,
选项=c(“温度”=“5a”,
“相对湿度”=“5b”,
“压力”=“5c”,
“空气中颗粒的质量密度(直径<2.5μm)”=“0a”,
“空气中颗粒的质量密度(直径<10μm)”=“0b”,
“风速”=“6”),倍数=真,
选定=c(“5b”、“5a”、“6”))
我试着跟随,但由于我没有现有的图像使用,我认为它不适合我的需要。我还尝试在每个下拉选项上插入一个圆圈图标,我想尝试给它上色,但没能做到。

库(闪亮)
shinyApp(
ui=fluidPage(
选择输入(
“变量”,“变量:”,
选择=
c(“&bull;气缸”=“气缸”,
“&bull;传输”=“am”,
“&bull;齿轮”=“齿轮”),
选项=列表(渲染=I(“
{
项:函数(项,转义){return'+item.label+''';},
选项:函数(项,转义){return'+item.label+'';}
}
"))
),
表格输出(“数据”)
),
服务器=功能(输入、输出){
输出$数据
library(shiny)

shinyApp(
  ui = fluidPage(
    selectizeInput(
      "variable", "Variable:",
      choices = 
        c("<span style='color:red;font-size:30px;vertical-align:bottom'>&bull;</span>&nbsp;Cylinders" = "cyl",
          "<span style='color:green;font-size:30px;vertical-align:bottom'>&bull;</span>&nbsp;Transmission" = "am",
          "<span style='color:blue;font-size:30px;vertical-align:bottom'>&bull;</span>&nbsp;Gears" = "gear"),
      options = list(render = I("
      {
        item:   function(item, escape) { return '<div>' + item.label + '</div>'; },
        option: function(item, escape) { return '<div>' + item.label + '</div>'; }
      }
    "))
    ),
    tableOutput("data")
  ),
  server = function(input, output) {
    output$data <- renderTable({
      mtcars[, c("mpg", input$variable), drop = FALSE]
    }, rownames = TRUE)
  }
)