I am trying to add R^2 values to each facet in a ggplot2 graph. This is the code I have so far and this is what the graph looks like currently.
ggplot(BB_new, aes(x=Date, y=pH, color=Treatment)) +
geom_point(pch=19, size=1,alpha = 1)+
geom_smooth(aes(color=NULL), method = "lm", formula = y ~ x + I(x^2), se = FALSE) +
theme_classic()+ theme(legend.title = element_blank())+
theme(legend.position = c(0.9,0.93))+
scale_color_manual(labels = c("Reference"),
values = c("coral1"))+
facet_wrap(~Hor) + ylim(2.5, 6)