Hi @Capucine, if I understood correctly, you want to plot the average value of y as a horizontal line across all values of x, right? In that case, you could try this:
mean_y <- mean(d$y, na.rm = TRUE) # get the mean of variable y
ggplot(d, aes(x, y)) +
geom_hline(yintercept = mean_y) + # draw horizontal line at the mean of y
geom_point()