Re: [R] summarizing a complex dataframe

2012-01-11 Thread jim holtman
will this do it for you: > x <- read.table(text = " m1_1 m2_1 m3_1 m1_2 m2_2 m3_2 +111222 + 211222 + 221222", header = TRUE) > # split out the main names of the column > x.names <- do.call(rbind, strsplit(names(x), "_")) > x

Re: [R] summarizing a complex dataframe

2012-01-11 Thread David Winsemius
On Jan 11, 2012, at 3:55 PM, Christopher G Oakley wrote: I need some help summarizing complex data frames (small example below): m1_1 m2_1 m3_1 m1_2 m2_2 m3_2 i1111222 i1211222 i2221222 For an arbitrary number of co

Re: [R] summarizing a complex dataframe

2012-01-11 Thread Bert Gunter
Well, if I understand what you want to do, it's straightforward, ?"[" (pay attention to the use of column names) and ?grep would pick out the columns you want and you could then use mapply or maybe rowMeans or whatever to get your summaries. HOWEVER ... I think what you should really should do is

Re: [R] summarizing a complex dataframe

2012-01-11 Thread Steve Lianoglou
Hi, On Wed, Jan 11, 2012 at 3:55 PM, Christopher G Oakley wrote: > I need some help summarizing complex data frames (small example below): > >    m1_1 m2_1 m3_1 m1_2 m2_2 m3_2 > i1    1    1    1    2    2    2 > i1    2    1    1    2    2    2 > i2    2    2    1    2    2    2 > > > For an arb

[R] summarizing a complex dataframe

2012-01-11 Thread Christopher G Oakley
I need some help summarizing complex data frames (small example below): m1_1 m2_1 m3_1 m1_2 m2_2 m3_2 i1111222 i1211222 i2221222 For an arbitrary number of columns (say m1 …. m199) where the column names have