I have an indicate matrix, like this:
John 1
Ann 2
Ruby 3
Clair 4
So I want translate this vector to number with keep order, like this:
(John,Ann,John,Clair,John,Ruby,Ann,John,Ruby)->(1,2,1,4,1,3,2,1,3)
I don't know how do it with R(without loop).
Please help me. Thks