Re: [R] grouping values

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

Any solution to my problem ?> To: r-help@stat.math.ethz.ch> From: ken.knoblauch@inserm.fr> Date: Mon, 23 Jun 2008 13:25:02 +0000> Subject: Re: [R] grouping values> > Daren Tan <daren76 <at> hotmail.com> writes:> > 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")) > > "cc"[4,] "D" "aa"[5,] "E" "cc"> > how to obtain m.new where "aa", "bb", and "cc" are groups, > belonging to the> > same group are separated by "|"> > [,1] [,2][1,] "aa" "A|D"[2,] "bb" "B"[3,] "cc" "C|E"> > > How about> > do.call("expand.grid", rep(list(c("u", "l")), 3))> Var1 Var2 Var3> 1 u u u> 2 l u u> 3 u l u> 4 l l u> 5 u u l> 6 l u l> 7 u l l> 8 l l l> > -- > Ken Knoblauch> Inserm U846> Institut Cellule Souche et Cerveau> D¨¦partement Neurosciences Int¨¦gratives> 18 avenue du Doyen L¨¦pine> 69500 Bron> France> tel: +33 (0)4 72 91 34 77> fax: +33 (0)4 72 91 34 61> portable: +33 (0)6 84 10 64 10> http://www.s!

 bri.fr> > ______________________________________________> 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.
_________________________________________________________________


	[[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 - 14:21:06 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 - 15:00:51 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