Dear list,

I hope I can define my problem in an understandable manner. I seek some funktion that finds me the index of the value in a vector 1 that is the least bigger then the value in another vector 2. And this for all values in vector 2.

For example:


vector 1 : c(1,2,6)

vector 2 : c(0,0.5,1,2,3,8)


the result should be as long as vector 2 and give the indices of the corresponding elements in vector 1:

result: c(1,1,2,3,3,NA)

Any suggestions how to do this without doing complicated loops through vector 2?


Cheers
Jannis

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to