[R] grouping values

From: Daren Tan <daren76_at_hotmail.com>
Date: Mon, 23 Jun 2008 13:10:10 +0000


I tried aggregate, apply etc, but can't get the right result.  

For example,  

m <- cbind(c(LETTERS[1:5]), c("aa", "bb", "cc", "aa", "cc"))     [,1] [,2][1,] "A"  "aa"[2,] "B"  "bb"[3,] "C"  "cc"[4,] "D"  "aa"[5,] "E"  "cc"
how to obtain m.new where "aa", "bb", and "cc" are groups, and more than one values "A" to "E" belonging to the same group are separated by "|"
       [,1] [,2][1,] "aa"  "A|D"[2,] "bb"  "B"[3,] "cc"  "C|E"
Easily edit your photos like a pro with Photo Gallery.

        [[alternative HTML version deleted]]

R-help_at_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. Received on Mon 23 Jun 2008 - 13:24:16 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 23 Jun 2008 - 14:30:59 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive