getRangeForDiscretizedValue: Get the range-/bucket-ID of a given value.

Description Usage Arguments Value Author(s) Examples

View source: R/discretization.R

Description

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.

Usage

1

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.

Author(s)

Sebastian Hönel sebastian.honel@lnu.se

Examples

1
2
3
4
5
buckets <- mmb::discretizeVariableToRanges(
  data = iris$Sepal.Length, openEndRanges = TRUE)

mmb::getRangeForDiscretizedValue(
  ranges = buckets, value = mean(iris$Sepal.Length))

mmb documentation built on Oct. 23, 2020, 5:21 p.m.