Description Usage Arguments Value Author(s) Examples
Finds the index point where two index vectors are closest in value
1 | which.min.diff(a, vect)
|
a |
input vector |
vect |
input vector |
The index where abs(a-vect)
is smallest, ie where a
and vect
are smallest.
Piotr Fryzlewicz <p.fryzlewicz@imperial.ac.uk>
1 2 3 4 5 6 7 8 9 10 11 12 | #
# Make up two vectors
#
a <- c(1,2,3)
vect <- c(3,2,1)
#
# Now see on which index are the two closest in value
#
which.min.diff(a,vect)
#[1] 2
#
# ie its the second index where both vectors are actually 2
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.