I am trying to compare two sorted vectors, all elements in both vectors are not duplicated. Ex. a = c[5, 10, 13, 19, 23] b = c[1, 4, 7, 9, 15] For each element in a, i need find the max element in b which is smaller than it, so the short answer will look like [4, 9, 9, 15, 15]. I dont want to use any loop since my real project contains element in millions. Is there any way to speed up my operation? Many Thanks. -- View this message in context: http://r.789695.n4.nabble.com/Help-Using-vectorization-method-for-vectors-comparision-tp3004952p3004952.html Sent from the R help mailing list archive at Nabble.com.
______________________________________________ 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.