Hi. I am desperated.
Included this code at the beginning of server part and the respective code in UI
y_data <- reactive({
if (input$yearset == "prev")
y_prev
else if (input$yearset == "akt")
y_akt
})
e.g. output is then generated by
- filtering for departement (abt)
- plotting with a plotter function loaded from function.R, because I need it several times.
output$pstat <- renderPlot({
df <- y_data()$df.stat %>% filter(abt==input$var1)
plotter_abt(df,mon, drg, "Eff_Gewichte")
plotter_abt <- function(dd,xname, yname, ybez) {
x_var <- enquo(xname)
y_var <- enquo(yname)
ggplot(dd, aes(x = !!x_var, y = !!y_var, group=jahr, colour=jahr))+
geom_point() + geom_line() + theme_bw() +
guides(colour = FALSE, alpha = FALSE, size = FALSE) +
ggtitle(ybez, "Vorjahr (schwarz)") + labs(x = "Monat", y = ybez) +
scale_x_continuous(breaks = y_data()$br) + scale_y_continuous(limits = c(0, NA))
}
I always get:
Error: couldn't find y_data
and very strange in on part of my program one table is rendered correct:
output$koff <- renderTable(y_data()$off,spacing = "xs",striped = TRUE)
and only in this part the output of the table changes , when I change "yearset".
Strange behavior, I can't explain.
I tried nearly everything, even if I put y_data()$df.stat directly anywhere I get errors.
Even if I include the plotting routine directly within renderPlot() it doesn't work.
I study your both videos. I liked them, learned so much, but I didn't find my problems.
Before I decided to implement changes in years everything worked fine.