Re: [R] Group by in R

2009-04-14 Thread Paul Johnson
On Mon, Apr 13, 2009 at 8:56 AM, Nick Angelou nikola...@yahoo.com wrote: data   X1 X2 X3 X4 1   1  2  2  1 2   1  1  2  2 3   1  1  2  2 4   2  2  1  2 5   1  1  2  2 6   2  2  1  2 7   1  1  2  1 8   2  2  1  2 9   1  2  1  1 10  1  1  2  2 sqldf(select X1, X2, X3, X4, count(*) CNT

Re: [R] Group by in R

2009-04-13 Thread Gabor Grothendieck
combinations of f1-f4. In SQL I would just write: SELECT COUNT(*) FROM table GROUP BY f1, f2, ..,f4. How to do this in R? Thanks, Nick -- View this message in context: http://www.nabble.com/Group-by-in-R-tp23020587p23020587.html Sent from the R help mailing list archive at Nabble.com

Re: [R] Group by in R

2009-04-13 Thread Mike Lawrence
GROUP BY f1, f2, ..,f4. How to do this in R? Thanks, Nick -- View this message in context: http://www.nabble.com/Group-by-in-R-tp23020587p23020587.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

[R] Group by in R

2009-04-13 Thread Nick Angelou
Hi, I have the following table data: f1, f2, f3, f4. I want to compute the counts of unique combinations of f1-f4. In SQL I would just write: SELECT COUNT(*) FROM table GROUP BY f1, f2, ..,f4. How to do this in R? Thanks, Nick -- View this message in context: http://www.nabble.com/Group

Re: [R] Group by in R

2009-04-13 Thread Duncan Murdoch
Nick Angelou wrote: Hi, I have the following table data: f1, f2, f3, f4. I want to compute the counts of unique combinations of f1-f4. In SQL I would just write: SELECT COUNT(*) FROM table GROUP BY f1, f2, ..,f4. How to do this in R? table(f1,f2,f3,f4) will give you the counts. Other

Re: [R] Group by in R

2009-04-13 Thread Peter Dalgaard
. I want to compute the counts of unique combinations of f1-f4. In SQL I would just write: SELECT COUNT(*) FROM table GROUP BY f1, f2, ..,f4. How to do this in R? Thanks, Nick -- View this message in context: http://www.nabble.com/Group-by-in-R-tp23020587p23020587.html Sent from the R help

Re: [R] Group by in R

2009-04-13 Thread Nick Angelou
table data: f1, f2, f3, f4. I want to compute the counts of unique combinations of f1-f4. In SQL I would just write: SELECT COUNT(*) FROM table GROUP BY f1, f2, ..,f4. How to do this in R? Thanks, Nick -- View this message in context: http://www.nabble.com/Group-by-in-R

Re: [R] Group by in R

2009-04-13 Thread Gabor Grothendieck
this in R? Thanks, Nick -- View this message in context: http://www.nabble.com/Group-by-in-R-tp23020587p23020963.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman

Re: [R] Group by in R

2009-04-13 Thread David Winsemius
On Apr 13, 2009, at 7:26 AM, Nick Angelou wrote: Thanks a lot, guys. Gabor's and Mike's suggestion worked. Duncan's did not do exactly what I expected (I guess it's the paste in Mike's that makes table work as I needed it). One more question - is there a convenient way to order the group

Re: [R] Group by in R

2009-04-13 Thread Nick Angelou
probably do this in SQL with a combination of OUTER JOINs but I thought that R might have a more elegant solution based on factor and table. Thanks, Nick -- View this message in context: http://www.nabble.com/Group-by-in-R-tp23020587p23022717.html Sent from the R help mailing list archive

Re: [R] Group by in R

2009-04-13 Thread Gabor Grothendieck
I could probably do this in SQL with a combination of OUTER JOINs but I thought that R might have a more elegant solution based on factor and table. Thanks, Nick -- View this message in context: http://www.nabble.com/Group-by-in-R-tp23020587p23022717.html Sent from the R help mailing list