Dear group, Here is a list of elements :
l <- c("100415", "100416", "100419", "100420", "100421", "100422", "100423", "100426", "100427", "100428", "100429", "100430", "100503", "100504", "100505", "100506", "100507", "100510", "100511", "100512", "100513", "100514", "100517", "100518", "100519", "100520", "100521", "100524", "100525", "100526", "100527", "100528", "100531") > l[3:4] [1] "100419" "100420" #result is fine > l[(which(100420==l))-1:which(100420==l)] [1] "100419" "100416" "100415" #can't understand why I do not have same result than the above line Thank You for help ______________________________________________ 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.