This method uses ggplot_build
to access the rightmost point in the actual geom_smooth
lines to add a label above it. It's a more roundabout way of doing it, but it generalizes to other smoothing methods.
library(ggplot2)
set.seed(1)
#toy data
data = data.frame(month=rep(seq(1,12),2),
year = as.factor(c(rep(2019,12),rep(2020,12))),
val = c(runif(12,80,100),runif(12,10,30)))
p <- ggplot(data,aes(x=month,y=val,color=year))+
geom_point()+
geom_line()+
stat_smooth(method="lm",formula = y~1,se=T)
library(dplyr)
p.smoothedmaxes <-
ggplot_build(p)$data[[3]] %>%
group_by( group) %>%
mutate( xmean = mean(x)) %>%
filter( x == max(x))
p +
geom_text( data = p.smoothedmaxes,
mapping = aes(x = x, y = y, label = round(y,2)),
col = p.smoothedmaxes$colour,
nudge_y = 7,
inherit.aes = FALSE)

If you want the label in the middle instead, change the geom_text x mapping to x = xmean
.
data[[3]]
is used because stat_smooth
is the third graph layer -- change as needed.