which.nearest {swfscMisc} | R Documentation |
Which Nearest
Description
Find values of one vector that are nearest to values in another vector.
Usage
which.nearest(x, y)
Arguments
x |
vector of values to be compared against. |
y |
vector of values to examine relative to @return For each value in |
Author(s)
Tim Gerrodette tim.gerrodette@noaa.gov
Examples
x <- sort(sample(1:100, 20))
y <- sort(sample(min(x):max(x), 5))
i <- which.nearest(x, y)
x
y
x[i]
[Package swfscMisc version 1.6.5 Index]