Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/nearestReftoX.R
Find nearest element of a sorted reference vector and to each element of x.
1 | nearestReftoX(x, reference, ...)
|
x |
numeric vector. |
reference |
numeric vector, sorted in increasing order. |
... |
other arguments as passed to |
This function finds the element of a reference table (reference
) that is closest to each element of an incoming vector (x
).
The function is a simple wrapper for findInterval
in the base package.
It calls findInterval
with vec
equal to the mid-points between the reference values.
Integer vector giving indices of elements of reference
.
Gordon Smyth
1 | nearestReftoX(c(-10,0.5,0.6,2,3), reference = c(-1,0,2))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.