groupBy {SparkR}R Documentation

GroupBy

Description

Groups the DataFrame using the specified columns, so we can run aggregation on them.

Usage

## S4 method for signature 'DataFrame'
groupBy(x, ...)

## S4 method for signature 'DataFrame'
group_by(x, ...)

group_by(x, ...)

groupBy(x, ...)

Arguments

x

a DataFrame

Value

a GroupedData

See Also

GroupedData

Examples

## Not run: 
##D   # Compute the average for all numeric columns grouped by department.
##D   avg(groupBy(df, "department"))
##D 
##D   # Compute the max age and average salary, grouped by department and gender.
##D   agg(groupBy(df, "department", "gender"), salary="avg", "age" -> "max")
## End(Not run)

[Package SparkR version 1.5.1 Index]