My shiny app works , however it is incredibly verbose. I repeat myself alot.
Let's say I need to create multiple (11 total) variable names that
will take an input from a reactive variable of the same number
I need to render print each one individually not in a dataframe or
table. How can I loop through these so that I would not have to write
each one out like this:
#works, this is fine the way it is
time_1_1a <-reactive({
n=input$time1_1
f= as.numeric(trigfile1()[1]+n)
f
})
# works,this is fine the way it is
time_1_1b<-reactive({
n=input$time1_1
ip =input$ip1_1
f=as.numeric(trigfile1()[2]+n+ip)
f
})
output$t1_1<-renderText{
tout= paste0("time1=", time_1_1a(), ","time2=,time_1_1b())
}
I have tried this but it does not work I am not sure it will.
nn <-reactive( 1:11 )
for(i in nn()) {
tname=reactive(paste0("t",i,"_1"))
output$tname()<-renderText({
for(j in nn()){
t1a =reactive(paste0("time_",j,"_1a()"))
t1b= reactive(paste0("time",j,"_1b()") )
t_out <-reactive(paste0("t1=", t1a(),",", "t2=",t2a()))
return(t_out())
}
})
}
I will post a repex when I get back to my desk if this is not clear.