Xiaodong Jin wrote: > how to realize the following SQL command in R? > > select distinct A, B, count(C) > from TABLE > group by A, B > ; > quit; > > Best Regards
You don't say which database you are using, but I have found RODBC to be very effective. library("RODBC") Have a look at odbcConnect(), and sqlQuery(). It is quite straightforward; even I managed to use it! Otherwise try help.search("sql") which provides links to many other, database-specific packages. Mark -- Dr. Mark Wardle Clinical research fellow and Specialist Registrar in Neurology, C2-B2 link, Cardiff University, Heath Park, CARDIFF, CF14 4XN. UK ______________________________________________ R-help@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.