VAS<-c("Green","Green","Black","Green","White","Yellow","Yellow","Black","Green","Black") c(factor(VAS)) # to give integer indexing to the colors
--- This is very nice, Frank. And it can be easily adjusted to match the original criterion that the numbers match the order of appearance of the colors in the original vector: c(factor(VAS,levels=unique(VAS))) -- View this message in context: http://r.789695.n4.nabble.com/Help-with-vectors-tp4711801p4712061.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.