Re: [R] Selecting values based on two criteria

2014-12-26 Thread Boris Steipe
Try this: d1 <- c(135631,136950,137952,138787,139623,142231,143067,144762, 145601,146441) d2 <- c(135882,136954,137956,138792,139630,140569,141398,142237, 143078,143907,144771,145611,146446,147285,148128) len <- length(d1) # concatenate the two vectors mrg <- c(d1,d2) # order the

[R] Selecting values based on two criteria

2014-12-26 Thread Morway, Eric
I'm in need of help selecting from d2 those values that come after a value in d1. For example, d2[1] is both greater than d1[1] and is the value that is closest to d2[1]. Similarly, d2[2] is both greater than d1[2] and is the next "highest" number in d2. Every value in d1 has a corresponding val