clips10 <m.mcquillan <at> lancaster.ac.uk> writes: > 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) [... snip to make gmane happy ...], > so my new vector would be (1,1,2,3,1,2,2,3,4,3).
x <- c(2,2,4,6,2,4,4,6,8,6) as.numeric(factor(x)) [1] 1 1 2 3 1 2 2 3 4 3 ______________________________________________ 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.