agg {SparkR}R Documentation

summarize

Description

Aggregates on the entire DataFrame without groups. The resulting DataFrame will also contain the grouping columns.

Usage

## S4 method for signature 'GroupedData'
agg(x, ...)

## S4 method for signature 'GroupedData'
summarize(x, ...)

Arguments

x

a GroupedData

Details

df2 <- agg(df, <column> = <aggFunction>) df2 <- agg(df, newColName = aggFunction(column))

Value

a DataFrame

See Also

Other agg_funcs: approxCountDistinct, approxCountDistinct, approxCountDistinct; avg, avg; countDistinct, countDistinct, n_distinct, n_distinct; count, n, n; first, first; kurtosis, kurtosis; last, last; max; mean; min; sd, sd, stddev, stddev; skewness, skewness; stddev_pop, stddev_pop; stddev_samp, stddev_samp; sumDistinct, sumDistinct; sum; var_pop, var_pop; var_samp, var_samp; var, var, variance, variance

Examples

## Not run: 
##D  df2 <- agg(df, age = "sum")  # new column name will be created as 'SUM(age#0)'
##D  df3 <- agg(df, ageSum = sum(df$age)) # Creates a new column named ageSum
##D  df4 <- summarize(df, ageSum = max(df$age))
## End(Not run)

[Package SparkR version 1.6.1 Index]