How can I calculate sample 90th percentile?

Hi, and welcome!

Please see the FAQ: What's a reproducible example (`reprex`) and how do I do one? Using a reprex, complete with representative data will attract quicker and more answers. For this question, it's easy to come up with an example from standard data sets, but that won't always be the case.

suppressPackageStartupMessages(library(dplyr)) 
# construct a numeric vector from the iris built-in dataset
iris %>% select(Sepal.Length) -> sl
sl$Sepal.Length -> sl
# return the required percentile
quantile(sl,0.9)
#> 90% 
#> 6.9

Created on 2020-03-22 by the reprex package (v0.3.0)

1 Like