I would like to plot the following data frame as a boxplot:
df <- structure(list(gender = c("M", "M", "F", "F", "F", "M", "M",
"M", "F", "F", "M", "M", "F", "F", "M"), age = c(0.047843262001096,
-0.742811587141869, 0.925285031087175, 0.0921270156895479, -0.869460001218705,
-0.468079587412729, -0.480948831743091, 0.879330955606316, -0.249821527515907,
0.386670185484268, 0.670264658324484, 0.382273448950274, 0.0500787926732772,
2.39384630378084, 0.862479212110272)), row.names = c(NA, -15L
), class = c("tbl_df", "tbl", "data.frame"))
I would like to replace the point with a horizontal dashed line:
ggplot(df, aes(x = gender, y = age)) + geom_boxplot() +
stat_summary(fun.data = mean_sdl, geom = "point", color = "red")
I have tried "line" instead of "point" but doesnt seem to produce anything. Any ideas?