如何在selectInput of shiny - rstudio中使用键盘方向键

时间:2017-04-18 08:39:36

标签: shiny rstudio

在下面的代码中,如何使用键盘方向键上下来从下拉列表中选择类别,一旦我点击“输入”,我想选择它。

rm(list = ls())
library(shiny)
mychoices <- c("A1", "A2", "B1", "B2", "C1", "C2")

ui <- fluidPage(
selectInput("campaigns", "Choose campaign(s):", multiple = T, choices = 
mychoices),

)
server <- function(input, output, session) {


}

runApp(list(ui = ui, server = server))

1 个答案:

答案 0 :(得分:0)

这是一个基本示例,应该允许您使用游标并查看结果。

library(shiny)
rm(list = ls())

mychoices <- c("A1", "A2", "B1", "B2", "C1", "C2")

ui <- fluidPage(
  column(4,selectInput("campaigns", "Choose campaign(s):", multiple = T, choices = 
                mychoices)),
  column(8, textOutput("prints"))

)
server <- function(input, output, session) {

  output$prints <- renderText({ 
    if(length(input$campaigns) == 0 ) return()
    input$campaigns
  })
}

runApp(list(ui = ui, server = server))

如果它适合您,请告诉我。