This function performs operations by grouping the data.

agg_by_group(df = NULL, my_formula = NULL, func = NULL, ...)

Arguments

df

The data set for which correlations are required

my_formula

A formula such as A~B where B is the grouping variable(normally a factor). See examples below

func

The kind of operation e.g sum,mean,min,max,manymodelr::get_mode

...

Other arguments to 'aggregate' see ?aggregate for details

Value

A grouped data.frame object with results of the chosen operation.

Examples

head(agg_by_group(airquality,.~Month,sum))
#> Grouped By[1]:	Month 
#>  
#>   Month Ozone Solar.R  Wind Temp Day
#> 1     5   579    4369 276.1 1595 386
#> 2     6   265    1658 109.6  704 129
#> 3     7  1537    5627 221.6 2181 422
#> 4     8  1380    3981 203.8 1925 395
#> 5     9   912    4878 292.2 2230 438