I have data with around 25,000 rows
myData with column
attr having values from 0 -> 45,600. I am not sure how to make a simplified or reproducible data...
Anyway, I am plotting the density of
attr like below, and I also find the
attr value where density is maximum:
library(ggplot) max <- which.max(density(myData$attr)$y) density(myData$attr)$x[max] # This is the x-intercept of max point ggplot(myData, aes(x=attr))+ geom_density(color="darkblue", fill="lightblue")+ geom_vline(xintercept = density(myData$attr)$x[max])+ xlab("attr")
My questions now are:
1. Why does it have 2 maximum points now? Why is my x-intercept no longer at the maximum point(s)?
2. How do I find the intercepts for the 2 new maximum points?