I dont know why but I'm failing to add a dashed red line representing the mean of the y-values to my boxplot:
df %>%
ggplot(aes(x = month, y= dep_delay)) +
theme(panel.grid.major.y = element_line(color = "darkgrey",
size = 0.5,
linetype = 2)) +
geom_boxplot(colour = '#003399', varwidth=T, fill="lightblue")+
geom_hline(aes(yintercept=mean(dep_delay), linetype = "dashed", color = "red")) +
labs(title="Departure delays in Newark airport per month",
x="", y = "duration of delays")
the parameters linetype and color show up as a legend on the right without affecting my line.
I have also tried 'geom_hline(yintercept=mean(dep_delay,linetype = "dashed", color = "red"))'.

does anyone know what I'm doing wrong?

aes(yintercept = mean(dep_delay)), linetype = "dashed", colour = "red"to get it right, i.e. move the parenthesis. You're now mapping them to scales instead of using them as 'plain' parameters.