Re: [R] Tabulating using arbitrary numbers of factors

2009-10-03 Thread Jim Lemon
On 10/03/2009 04:15 AM, Andrew Spence wrote: Dear R-help, First of all, thank you VERY much for any help you have time to offer. I greatly appreciate it. I would like to write a function that, given an arbitrary number of factors from a data frame, tabulates the number of occurrences of eac

Re: [R] Tabulating using arbitrary numbers of factors

2009-10-02 Thread jim holtman
try 'reshape': > require(reshape) > # add a column to accumulate on > tmp$inc <- 1 > recast(tmp, f1 + f2 + f3 ~ ., sum) Using f1, f2, f3 as id variables f1 f2f3 (all) 1MaleWhite 0-20 3 2MaleWhite 21-40 4 3MaleWhite 41-60 2 4MaleWhite 61

Re: [R] Tabulating using arbitrary numbers of factors

2009-10-02 Thread Erik Iverson
lling the function, does this produce what you want? with(tmp, test(f1, f2, f3)) ## END R SAMPLE CODE Best Regards, Erik Iverson > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Andrew Spence > Sent: Friday, October 0

[R] Tabulating using arbitrary numbers of factors

2009-10-02 Thread Andrew Spence
Dear R-help, First of all, thank you VERY much for any help you have time to offer. I greatly appreciate it. I would like to write a function that, given an arbitrary number of factors from a data frame, tabulates the number of occurrences of each unique combination of the factors. Cleary,