Shiny R: Populate a list from input and return list on output via reactive -
i try populate list on shiny elements of list passed on shiny input. list should accumulate made choices. list should sent shiny output. list can send output. list of length 1 , single element gets updated input does. interested in "names" of list, why assign value 1 each name element:
ui.rshinyui( fluidrow( column(1, # reactive input selectinput("input1", label = "select parameter 1", choices = c("none",letters[1:16]), multiple = t), selectinput("input2", label = "select parameter 2", choices = c("none",c(1:24) ) multiple = t), # printout of list htmloutput("printoutlist") ) # end of column ) # end of fluid row ) # end of shiny ui
shiny.r
# create empty list container <- list() shinyserver(function(input, output) { # pass on input reactive inputinfo <- reactive({ if(input$input1 == "none" | input$input2 == "none") { "-" } else { paste(input$input1 ,input$input2, sep = "") } }) # fill list , pass on list output output$printoutlist <- renderui({ container[[inputinfo()]] <- 1 paste("you have chosen: ", names(container), sep = "") }) )} #end of shinyserver function
any idea how solve this? tried around lot... unfortunately quite new r, shiny ! appreciate kind of help! !
include multiple = true argument selectinput
selectinput("input1", label = "select parameter 1", choices = c("none",letters[1:16]), multiple = true )
but seems server , ui files mixed , don't have shinyserver function in code.
Comments
Post a Comment