Thank you, Duncan,

Here “a” has the length of 24, and “b” has the length of 20 with numbers
from 1 to 20 uniquely. I just want encode “a” from 1 to 20 based on “a”
current order using “b”. So, a1[1] = b[1] = 1
a1[2] = b[2] = 5
a1[3] = a1[4] = b[3] = 8 (since third and fourth numbers are the same in
“a”)
a1[5] = a1[6] = b[4] = 9
a1[7] = b[5] = 14
a1[8] = b[6] = 20
a1[9] = b[7] = 3
a1[10] = a1[11] = b[8] = 10
...
a1[23] = b[19] = 15
a1[24] = b[20] = 19


--
View this message in context: 
http://r.789695.n4.nabble.com/Recode-numbers-tp3566395p3566681.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.

Reply via email to