getIndexClosestToValue | R Documentation |
Find the index of the value in an array that is closest to given
one. By default, no restriction is applied how big the absolute numerical
distance between value
and a value in the array
may be. A limit can be
set by the parameters thresholdAbs
or thresholdRel
. If no value within
the array
has the distance to value
that is equal to or less than the
threshold, the value
is considered not present in the array
and NULL
is returned.
getIndexClosestToValue(value, array, thresholdAbs = NULL, thresholdRel = NULL)
value |
Numerical value |
array |
Numerical array |
thresholdAbs |
Absolute numerical distance by which the closest value in
|
thresholdRel |
A fraction by which the closest value may differ from
|
Index of a value within the array which is closest to value
and the
difference is within the defined threshold. If multiple entries of array
have the same difference which is minimal, a vector of indices is returned.
If no value is within the defined threshold, NULL
is returned.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.