Given a list of previously computed ranges for a random variable, this function returns the index of the range the given value belongs to (i.e., in which bucket it belongs). The indexes start R-typically at 1. Per definition, a value is within a range, if it is larger than the range's minimum and less than or equal to its maximum.

getRangeForDiscretizedValue(ranges, value)

Arguments

ranges

list of ranges, as obtained by @seealso discretizeVariableToRanges

value

numeric a value drawn from the previously discretized random variable.

Value

integer the index of the range the given value falls into.

Examples

buckets <- mmb::discretizeVariableToRanges( data = iris$Sepal.Length, openEndRanges = TRUE) mmb::getRangeForDiscretizedValue( ranges = buckets, value = mean(iris$Sepal.Length))
#> [1] 4