Making input$ reactive

Hi all,

I have a shiny application with textInputs. These textInputs are reactive. So as per the length of colNames, the number of textInputs changes.

For example

colNames <- c("A","B")  # so there are 2 textInputs in shiny application

Above textInputs have id's as A and B respectively and the values are c("x","y","z") for both

I am creating a dataframe like below

data.frame(input$A, input$B) # meaning whatever the user selects, the dataframe should be formed

Now, say I have

colNames <- c("A","B","C","D","E","F")  # so there are 6 textInputs in shiny application

I will have to create again data.frame like below (which is a tedious task for the user).

data.frame(input$A, input$B,input$C, input$D,input$E, input$F )  #equation 1

In order to achieve above task more easily, I have created a for look like below

out <- c()
    for(i in 1:length(colNames)){
        out <- c(out, paste0("input$",colNames[i]))
    }

Finally I can put out inside dataframe

data.frame(out)   # instead of writing equation 1

But above code is not successful.

Can anyone help me?

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.