How to access individual radioButtons within a group of radioButtons created using renderUI and tagList()

53 views Asked by At

I am creating a set of radiobuttons using renderUI, and combining them into a single uiOutput called "Variables". For this, in the server function, I have created the individual radioButtons and grouped them using tagList(). Now I wish to access and display the individual radioButtons within the uiOutput "Variables", in a conditionalPanel, but indexing it like "Variables"[[i]] or Variables[[i]] is selecting the entire set of radioButtons instead of just the ith radioButton. Can someone please suggest how I can access the individual radioButtons of "Variables" instead of the entire set?

Here is the code I am using to create "Variables" within the server function

output$Variables <- renderUI({
    numVar <- 2

    taglist = list(radioButtons(inputId = "file_num", label ="File number", choices = c("Choices will appear here")))
    for (i in 1:numVar){
      taglist = append(taglist, list(radioButtons(inputId = paste0("x_var_of_file", i, sep ="_") , label = paste("x Variables of file", i, sep = "-"), choices = c("Choices will appear here"))))
      taglist = append(taglist, list(radioButtons(inputId = paste0("y_var_of_file", i, sep ="_") , label = paste("y Variables of file", i, sep = "-"), choices = c("Choices will appear here"))))
    }
    tagList(taglist) 
  })
0

There are 0 answers