How to do group by in R

r
r_packages

#1

Hello,

How do i achieve an operation like group by in R.Is there any package or inbuilt function which helps to implement this SQL methodology.


#2

dplyr has a group_by() function.


#3

Hi,

Yeah dplyr has a group_by functions. Also you can use SQL codes in R, using Sqldf package! (Apart from outer joins it supports all SQL functionalities)

Hope this helps.

Regards,
Aayush


#4

R has a very good package called plyr for various data manipulations. It’s function ddply can be used for the above purpose as follows:
http://www.inside-r.org/packages/cran/plyr/docs/ddply

For bigger datasets, data.table has faster operations. It’s implementation can be found here:


#5

also try summarize from Hmisc package