I am currently working through a book to learn R and I am trying to plot an original stat_summary() using the geom function instead.
Original: ggplot(data = diamonds) + stat_summary(mapping = aes(x = cut, y = depth), fun.min = min, fun.max = max, fun = median)
Below is the closest translation I could put together, but I know that this is fairly off. One of the components that I think I am also having difficulties with is conversion from fun.min/max to ymin/max.
Would somebody be able to explain how they would go about translating stat_summary() to a geom_chart()?
Translation: ggplot(data = diamonds) + geom_pointrange(mapping = aes(x = cut, y = depth, ymin = depth, ymax = depth)) + geom_point(mapping = aes(x = cut, y = median(depth), color = "red"))