Hello,
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...
session$setInputs(
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 )
col_list <- c("age", "gender", "id", ..., "state")
for (i in 1:length(col_list)){
session$setInputs(
noquote(paste0("col_", i)) = col_list[i]
)
}