I'm learning to plot the density in R
This is what the sample looks like:
# A tibble: 10 x 2
start_time1 ClusterNumber
<dbl> <chr>
1 6.72 2
2 6.82 2
3 7.57 1
4 6.57 3
5 6.31 2
6 6.30 2
7 6.60 2
8 16.4 4
9 16.1 3
10 16.0 1
data <- structure(list(start_time1 = c(6.72472222222222, 6.82194444444444,7.57361111111111, 6.56611111111111, 6.31111111111111, 6.29916666666667,6.59555555555556, 16.3666666666667, 16.1305555555556, 16.0111111111111), ClusterNumber = c("2", "2", "1", "3", "2", "2", "2", "4","3", "1")), row.names = c(NA, -10L), class = c("tbl_df", "tbl","data.frame"))
So far, I have tried to plot the density separate with ClusterNumber;
ggplot(data, aes(x=start_time1)) +
geom_density(aes(group=ClusterNumber, colour=ClusterNumber, fill=ClusterNumber), alpha=0.1)+
labs(title="Starting time distribution",x="Starting Time (Hrs)", y = "Density")
However, I want to find the high-density value. How can I find it? using abline
?
Can I extract the exact value of the graph?
Thank you in advance.