Re: [R] Creating table from data frame

2010-09-23 Thread ZeMajik
That's golden Henrique, thanks a lot! Worked like a charm even with large datasets. On Tue, Sep 21, 2010 at 2:56 PM, Henrique Dallazuanna wrote: > Try this: > > d <- data.frame(A = letters[1:10], B = sample(letters[11:20]), C = > sample(10)) > xtabs(C ~ A + B, d) > > On Tue, Sep 21, 2010 at 8:39

Re: [R] Creating table from data frame

2010-09-21 Thread Henrique Dallazuanna
Try this: d <- data.frame(A = letters[1:10], B = sample(letters[11:20]), C = sample(10)) xtabs(C ~ A + B, d) On Tue, Sep 21, 2010 at 8:39 AM, ZeMajik wrote: > Hey, > > I have a dataset where two columns are factors and another column consists > of values. Each combination of factors can only ha

[R] Creating table from data frame

2010-09-21 Thread ZeMajik
Hey, I have a dataset where two columns are factors and another column consists of values. Each combination of factors can only have a single value assigned to it. I'd like to represent this as a matrix or table where the rows are the first column factors and the columns the second column factors.