agg {SparkR}R Documentation

summarize

Description

Aggregates on the entire SparkDataFrame without groups. The resulting SparkDataFrame 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 SparkDataFrame

See Also

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

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 2.0.0 Index]