How do I get the max value of the graph in `density(data?)`

(I want to plot a line on the plot to mark the mean value, as well as two other values. So I need to figure out about how big the plot area is in y-direction, so that the line covers the entire height of the plot(ish), but not more) (edited)

Call the kernel density estimation manually

From that you can easily find the maximum.

3 Likes

Thanks!