I am really stumped on something. I’m struggling to get the code below to run. Usually the “i” in the for-loop will retain whatever the taxon name is (Opt1/Opt2/etc), but when I am generating the reactive expression, in all cases it updates to be the last value of “i” (i.e. Opt5). Is there a way to make it not reactive? There are few print statements in there for troubleshooting purposes, but I'm still struggling!
EC_settings_rv <- reactiveValues( mVariableOpt1="All", mVariableOpt2="With reads", mVariableOpt3="All", mVariableOpt4="All", mVariableOpt5="All")
TaxaDataEC<-c("Opt1", "Opt2","Opt3", "Opt4","Opt5")
for(i in TaxaDataEC){
var<-paste0("EC_settings_rv$mVariable",i)
print(var)
isolate(print(eval(parse(text=paste0("EC_settings_rv$mVariable",i)))))
assign(paste0("mVariable",i,"_rv"),reactive({var}))
}
isolate(print(mVariableOpt2_rv())) #I want it to give "EC_settings_rv$mVariableOpt2, but it gives "EC_settings_rv$mVariableOpt5"
isolate(print(eval(parse(text=mVariableOpt2_rv())))) #I want it to give "With reads", but it gives "All"
Thanks for your help!