I created a reactive object that I want to use in other parts of the app but it is not working there, it only works when I output it using "output$outputid" alone. For example; when I Pr2()$a
in output$ex
it worked but using Pr2()$b
and Pr2()$c
did not work in lm1
and I am so confused;
Pr2 <- eventReactive(input$mspec,{
if (is.null(input$mspec)) return()
if (input$mspec==0) return()
if (input$msdata){
df <- Pr()
} else{
df <- Dataset()
}
good2 <- data.frame(df)
a <- data.frame(good2[,input$met2[1]:input$met2[2]])
b <- t(a)
c <- good2[,input$Prognostic]
return(list(a=a,b=b,c=c))
})
output$ex <- renderPrint({
print(Pr2()$c)
})
lm1 <- reactive({
if (is.null(input$mspec)) return()
if (input$mspec==0) return()
if (input$msdata){
df2 <- Pr()
} else{
df2 <- Dataset()
}
if (is.null(df2)) return(NULL)
isolate({
Mdataa=Pr2()$b
if (is.null(Mdataa)) return(NULL)
MetabolicSurv::MSpecificCoxPh(reformulate(Survival=input$Survival,Censor=input$Censor,Reduce=input$Reduce,Select=input$num4,Quantile=input$num5,Prognostic=Pr2()$c,Mdata=Mdataa))
})
})