Skip to contents

Select elements based on a cutoff on their values.

Usage

selectByCutoff(x, cutoff, operator = c("<", "<=", ">", ">="))

Arguments

x

numerical vector.

cutoff

numeric value indicating the cutoff.

operator

character string indicating the relational operator to use.

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
selectByCutoff(x = x, cutoff = 5, operator = "<")
#>    f1    f2    f3    f4    f5    f6    f7    f8    f9   f10 
#>  TRUE  TRUE  TRUE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE