and not just the number 86 that i can keep calculating with. Taking an example from this website
we have
#creates a vector of values
df<-c(12,3,4,56,78,18,NA,46,78,100,NA)
#returns the 22 and 77th percentiles of the input values
quantile(df,na.rm = T,probs = c(0.22,0.77))
which leads to the output
22% 77%
10.08 78.00
and not just a numeric vector. For my purposes I just need one value, so no vector is needed. Having said that, how can I implement something like
Cutoff<-quantile(...)
and get Cutoff to be the numeric value needed to cross a certain percentile, so I can then keep calculating with that number in my program?
Hi @Daniel_R. You can turn the quantile output to numeric by adding as.numeric(). Then, if there's a certain cutoff you're trying to achieve, you can limit the output by filtering.
#returns the 22 and 77th percentiles of the input values
my_quants = quantile(df,na.rm = T,probs = c(0.22,0.77)) |> as.numeric()
my_quants
#> [1] 10.08 78.00
cutoff = 25
final = my_quants[my_quants > cutoff]
final
#> [1] 78