I have the following problem related to this relatively simple code that doesn't work:
server.R
library(shiny)
server <- function(input, output) {
list_of_stuff=c("Car","Cat","Dog","Hat","Baby","Tractor")
reactive_stuff_list <- eventReactive({list(input$select_1,input$select_2,input$select_3)},{
selection_1=input$select_1
selection_2=input$select_2
selection_3=input$select_3
list_of_stuff=list_of_stuff[! list_of_stuff %in% selection_1]
list_of_stuff=list_of_stuff[! list_of_stuff %in% selection_2]
list_of_stuff=list_of_stuff[! list_of_stuff %in% selection_3]
return(list_of_stuff)
})
output$select1 <- renderUI({
selectInput(inputId = "select_1", label = "Select some stuff",
choices=reactive_stuff_list(), selected = NULL, multiple = TRUE)
})
output$select2 <- renderUI({
selectInput(inputId = "select_2", label = "Select some stuff",
choices=reactive_stuff_list(), selected = NULL, multiple = TRUE)
})
output$select3 <- renderUI({
selectInput(inputId = "select_3", label = "Select some stuff",
choices=reactive_stuff_list(), selected = NULL, multiple = TRUE)
})
}
ui.R
ui <- mainPanel(
uiOutput('select1'),
uiOutput('select2'),
uiOutput('select3')
)
WHAT I WOULD LIKE IT TO DO: I start with some list of elements. Then as soon as I select some elements in one of the "selectInputs" (say number 1) the initial list gets updated in the other ones as well so I can't select the ones I selected in number 1 in number 2/3.
Sadly I have no idea how to achieve this; tried some stuff but didn't get anything usable.
Basically I want them to be kind of linked so they are seperate but work together.
If I'm not clear, I can try to explain it differently. Any guidance would be very much appreciated