Skip to content

Instantly share code, notes, and snippets.

@xiaodaigh xiaodaigh/README.md
Last active Dec 23, 2015

Embed
What would you like to do?
Shiny: Multiple selections created using one htmlOutput

To run

shiny::runGist("6684134")

shinyServer(function(input, output, session) {
output$selectInputs <- renderUI({
print("w")
w <- ""
for(i in 1:input$obs) {
w <- paste(w,selectInput(paste("a",i,sep=""),paste("a",i,sep=""),choices=1:input$obs,selected=i))
}
HTML(w)
})
output$summary <- renderPrint({
print("your selections are:")
for(i in 1:input$obs) {
print(
input[[sprintf("a%d",i)]]
)
}
})
outputOptions(output, 'selectInputs', suspendWhenHidden=FALSE)
})
# Experimental Area ui shiny
shinyUI(basicPage(
verbatimTextOutput("summary"),
numericInput("obs", "how many selects:", 5,min = 1, max = 100)
,htmlOutput("selectInputs")
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.