Message-ID: <1371558887.88366.YahooMailClassic@web140401.mail.bf1.yahoo.com>
Date: 2013-06-18T12:34:47Z
From: Andras Farkas
Subject: find closest value in a vector based on another vector values
Dear All,
would you please provide your thoughts on the following:
let us say I have:
a <-c(1,5,8,15,32,69)
b <-c(8.5,33)
and I would like to extract from "a" the two values that are closest to the values in "b", where the length of this vectors may change but b will allways be shorter than "a". So at the end based on this example I should have the result "f" as
f <-c(8,32)
appreciate the help,
Andras