11

R/shiny Web アプリを作成しています。複数選択ボックスが必要です (checkboxGroupInput() を使用しますが、代替手段を利用できます)。ただし、選択肢のリストは長いので、選択肢のリスト全体をスクロールできるスクロール バーを備えた比較的小さなオプション ボックス (一度に 5 ~ 6 個のオプションを表示) に含めたいと考えています。

これを行う方法はありますか?最小限の例:

ui.R

library(shiny)
choices = paste("A",1:30,sep="_")

shinyUI(pageWithSidebar(

# Application title
headerPanel("my title"),
sidebarPanel(   
  checkboxGroupInput("inp", "choose any of the following", choices)
),
mainPanel(
   tableOutput("result")

)
))

サーバー.R

library(shiny)
shinyServer(function(input, output) {
myInput <- reactive({
    input$inp
})
output$result <- renderTable({
x = myInput()
if(length(x)==0) {
x = "No Choice Made"
}
matrix(x,ncol=1)
})

})
4

1 に答える 1

10

を使用するとうまくいくことがわかりましたselectInput(..., multiple = TRUE)

于 2013-03-12T02:25:28.993 に答える