Question: I have this `shiny` app where I want to use a set of `radioBuottons` to determine the vector of choices for another set of `radioBuottons`. I've tried using `conditionalPanel` but I cannot figure out how to bind different sets of `radioBuottons` to a single output entry (if that is even possible).
So I came up with defining a list for the second set of `radioBuottons` and try to select them depending on the choice of the first set of `radioBuottons`.

Here is an example of code:

**ui.r:**

```
library(shiny)

secondInput <- list(
  "a" = c("one", "two", "three"),
  "b" = c("four", "five")
)

shinyUI(fluidPage(
  titlePanel("Test reactive RadioButtons"),
    column(4,
      radioButtons("input1", label = "1st input", choices = c("a","b"))),
    column(4,
      radioButtons("input2", label = "2nd input depend on 1st input", choices = secondInput[[input$input1]])),
    column(4,
      textOutput("IN1"))
))

```

**server.r:**

```
library(shiny)

shinyServer(function(input, output) {
  out <- reactive(input$input1)
  output$IN1 <- renderText(out())
})

```

I get an error saying that object 'input' was not found. 
How can I manage this?

Answer: 
I think the `updateRadioButtons` would be better as there is no need to re-create the widget every time `input1` changes 

```
library(shiny)

secondInput <- list(
  "a" = c("one", "two", "three"),
  "b" = c("four", "five")
)

ui <- fluidPage(
  titlePanel("Test reactive RadioButtons"),
  column(4,radioButtons("input1", label = "1st input", choices = c("a","b"))),
  column(4,radioButtons("input2", label = "2nd input depend on 1st input", choices = "")),
  column(4,textOutput("IN1"))
)

# Define server logic
server <- function(input, output, session) {

  observeEvent(input$input1,{
    updateRadioButtons(session,"input2",choices = secondInput[[input$input1]])
  })

  out <- reactive(input$input1)
  output$IN1 <- renderText(out())
}

# Run the application 
shinyApp(ui = ui, server = server)

```
The `radioButtons` that you generated are not reactive. If you want to use one input to make another input or output dependent on it, you have to build the logic for that in reactive expressions in the server. You could use `uiOutput` and `renderUI` for this. A working example is given below, hope this helps!

```
library(shiny)

secondInput <- list(
  "a" = c("one", "two", "three"),
  "b" = c("four", "five")
)

ui <- fluidPage(
  radioButtons("input1", label = "1st input", choices = c("a","b")),
  uiOutput('radiobuttons2')
)

server <- function(input, output, session) {
  output$radiobuttons2 <- renderUI({
    radioButtons('input2',label='2nd input', choices = secondInput[[input$input1]])
  })

}

shinyApp(ui, server)

```