I didn't really know what to post as the topic subject, but I have a vector, for instance (2,2,4,6,2,4,4,6,8,6) and I want to create another vector which is just numbers from 1 to 4 since there are only 4 unique numbers in my vector, so for instance 2 would be 1, 4 would be 2, 6 would be 3, and 8 would be 4, so my new vector would be
(1,1,2,3,1,2,2,3,4,3). The vector I have has longer numbers, in the thousands, but it's the same principle I want. I have a vector of length 200 but I know there are only 160 unique numbers in there, so would like a new vector that just has numbers between 1 and 160 correpsonding to each unique element of the original vector, and is the same length as the original. Sorry if this is not very clear, Thanks very much for any help in advance. -- View this message in context: http://r.789695.n4.nabble.com/Creating-vectors-tp2321440p2321440.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.