Selecting the first occurrence of a value after an occurrence of a different value
Hi, I'll do something like this (there is probably a nicer way, but this code is what first comes up to my mind) provided your data is in x pos1 <- which(x %in% val1)[1] pos2 <- which(x %in% val2)[which(x %in% val2) > pos1][1]
View this message in context: http://r.789695.n4.nabble.com/Selecting-the-first-occurrence-of-a-value-after-an-occurrence-of-a-different-value-tp3217340p3217385.html Sent from the R help mailing list archive at Nabble.com.