[R] Printing data.frame data: alternatives to print?

2010-10-29 Thread Matthew Pettis
Hi, I have a data frame with two factors (well, more, but 2 for simple consideration), and I want to display the different combinations of the them that actually occur in the data. In reality, there are too many of them to do to do a 'table' call and have one col vertical and one col horizontal

Re: [R] Printing data.frame data: alternatives to print?

2010-10-29 Thread Jan van der Laan
Matt, Below are three (of the probably many more) possible ways of doing this: aggregate(1:nrow(df), df, length) ftable(1 ~ f1 + f2, data=df) library(plyr) ddply(df, .(f1,f2), nrow) Regards, Jan On 29-10-2010 15:53, Matthew Pettis wrote: Hi, I have a data frame with two factors (well,

Re: [R] Printing data.frame data: alternatives to print?

2010-10-29 Thread jim holtman
Is this what you want: df f1 f2 1 Maj I Minor A 2 Maj I Minor A 3 Maj I Minor A 4 Maj II Minor A 5 Maj II Minor B 6 Maj II Minor B 7 Maj III Minor B 8 Maj III Minor C 9 Maj III Minor C df[!duplicated(df),] f1 f2 1 Maj I Minor A 4 Maj II Minor A 5 Maj II

Re: [R] Printing data.frame data: alternatives to print?

2010-10-29 Thread Matthew Pettis
I think that'll work... thanks! matt On Fri, Oct 29, 2010 at 9:45 AM, jim holtman jholt...@gmail.com wrote: Is this what you want: df       f1      f2 1   Maj I Minor A 2   Maj I Minor A 3   Maj I Minor A 4  Maj II Minor A 5  Maj II Minor B 6  Maj II Minor B 7 Maj III Minor B 8 Maj