2013-03-11 41 views
8

我構建了一個R /閃亮的web應用程序。我想有一個多選框(我使用checkboxGroupInput(),但我可以選擇)。然而,選項列表很長,我想用一個相對較小的選項(一次顯示5-6個選項)將其包含在一個滾動條中,以便滾動瀏覽整個選項列表。R /閃亮的多選框 - 添加滾動條

有沒有辦法可以做到這一點? 小例子:

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") 

) 
)) 

server.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) 
}) 

}) 

回答

10

我發現,使用selectInput(..., multiple = TRUE)做的伎倆。