Skip to contents

Select elements based on the percentile of the highest values.

Usage

selectByPercentile(x, percentile = 0.25)

Arguments

x

numerical vector.

percentile

numerical value in the range \([0, 1]\) indicating the percentage of elements to keep.

Value

A logical vector, indicating the elements to keep.

Author

Alessandro Barberis

Examples

#Seed
set.seed(1010)

#Data
x = seq(10)
names(x) = paste0("f", seq(10))

#Select
selectByPercentile(x = x, percentile = 0.25)
#>    f1    f2    f3    f4    f5    f6    f7    f8    f9   f10 
#> FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE  TRUE  TRUE