[R] query in R

Jens Scheidtmann JensScheidtmann at web.de
Tue Nov 14 17:33:42 CET 2006


Xiaodong Jin <close2ceo at yahoo.com> writes:

> how to realize the following SQL command in R?
>    
>   select distinct A, B, count(C)
>   from TABLE
>   group by A, B
>   ;
>   quit;

The functional equivalent of is statement in R on a dataframe is:

TABLE$ones <- 1;
aggregate(TABLE$ones, list(TABLE$a, TABLE$b), sum);

HTH,

Jens



More information about the R-help mailing list