Re: [R] RES: Recode numbers

2011-06-01 Thread Lisa
Thank you very much, Bill. Your script works very well. -- View this message in context: http://r.789695.n4.nabble.com/Recode-numbers-tp3566395p3566847.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list h

Re: [R] RES: Recode numbers

2011-06-01 Thread Lisa
Thank you so much, Filipe. Your R script is what I am looking for. -- View this message in context: http://r.789695.n4.nabble.com/Recode-numbers-tp3566395p3566818.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org ma

[R] RES: Recode numbers

2011-06-01 Thread Filipe Leme Botelho
--- Begin Message --- I think this is proper. a <- c(1, 2, 3, 3, 4, 4, 5, 6, 1, 2, 2, 3, 1, 2, 1, 2, 3, 3, 4, 5, 1, 2, 3, 4) b <- c(1, 5, 8, 9, 14, 20, 3, 10, 12, 6, 16, 7, 11, 13, 17, 18, 2, 4, 15, 19) ref <- 1 for (i in 2:length(a)) { if (a[i]!=a[i-1]) ref <- c(ref, ref[length(ref)]+1) if