I have a shiny app that creates numerous reactive values variables depending on other user input. I named these variables in a loop with the assign() function. Ex: list_index1, list_index2, list_index3,... I cannot figure out to access the value of these variable in a loop. Of course i could do list_index3$value, but I want to be able to access everyone of the variables' values in a loop. If I try something like:
paste("list_num", 2, sep="")$value
I get the error
Warning: Error in $: $ operator is invalid for atomic vectors
I'm not sure how to go about doing this. Any help is appreciated. The code for this section of the app is below. Thanks.
test_var <<- 3
observeEvent(input$numoc, {
test_var <<- input$numoc
})
for (i in 1:test_var) {
assign(paste("list_num", i, sep=""),reactiveValues(value=NULL))
assign(paste("list_index", i, sep=""), reactiveValues(value=NULL))
list_num <- reactiveValues(value=NULL)
list_index <- reactiveValues(value=NULL)
}
for (i in 1:3) {
observeEvent(paste("list_num", 2, sep="")$value, { updateSliderInput(session, "val2", max=list_num$value)
updateNumericInput(session, "val22", max=list_num$value)