Hello,
I want to reuse predicted values in calculation
eg my code
type predictionRadio <-reactive({
y_predTV<- req(y_predTV)
x <- input$user_input
x<-as.data.frame(x)
names(x)<-"Total_invest"
# Example: Simple linear model y = 2x + 3
y_predRadio <- round((x-y_predTV)/0.16*100,digits = 2)
return(y_predRadio)
})
#TV
predictionTV <- reactive({
x <- input$user_input
x<-as.data.frame(x)
names(x)<-"Total_invest"
# Example: Simple linear model y = 2x + 3
y_predTV <- round(predict(model2,x),digits = 2)
if (x$Total_invest==0) y_pred<- 0
return(y_predTV)
})
so in first part y_predTV is not found to calculate that formula.
How to solve such problems?
Kind regards
Nobel