find_interval: Find interval containing a specific value from an...

Description Usage Arguments Details Value

View source: R/misc.R

Description

Find interval containing a specific value from an quantilefactor object

Usage

1
find_interval(x, val, return_labels = FALSE)

Arguments

x

a factor object created with gen_quantiles

val

a numeric vector containing the value(s) to search for

return_labels

if TRUE; returns the label of the quantile, otherwise the number

Details

function checks the pattern of the factor labels, which have to be in the form of an interval. The specific regular expression that is checked is ^(\(|\[)-*[0-9.]+(e-\d+)*,-*[0-9.]+(e-\d+)*(\)|\])$.

Value

returns the number of the quantile to which each element in x belongs. The lowest quantile has number 1 (not 0).


baruuum/btoolbox documentation built on Aug. 17, 2020, 1:29 a.m.