Shiny testing with dynamic inputs


I am attempting to perform testing on my shiny app using the testServer function. My app has a dynamic number of inputs as a user can upload a file with a varying number of columns.

My session$setInputs function currently looks like this...

  col_1 = "age"
  ,col_2 = "gender"
  ,col_3 = "id"
  ,col_20 = "state

How can I clean this up so that I don't have to explicitly write out each line? I've tried using a for loop, but that isn't working.

Here's essentially what I'd like it to look like (but working :slight_smile: )

col_list <- c("age", "gender", "id", ..., "state")
for (i in 1:length(col_list)){
    noquote(paste0("col_", i)) = col_list[i]

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.