[R] query in R
Dong H. Oh
doriaba2 at snu.ac.kr
Tue Nov 14 18:08:03 CET 2006
sqlQuery() function in RODBC library will be helpful.
Sincerely,
On Nov 15, 2006, at 1:33 AM, Jens Scheidtmann wrote:
> 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
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
>
===========================================
Dong H. Oh
Ph. D Candidate
Techno-Economics and Policy Program
College of Engineering, Seoul National University,
Seoul, 151-050, Republic of Korea
E-mail:doriaba2 at snu.ac.kr
Mobile: +82-10-6877-2109
Office : +82-2-880-9142
Fax: +82-2-880-8389
More information about the R-help
mailing list