Skip to contents

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

Compute aggregates by specifying a list of columns

Usage

agg(x, ...)

summarize(x, ...)

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

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

# S4 method for class 'SparkDataFrame'
agg(x, ...)

# S4 method for class 'SparkDataFrame'
summarize(x, ...)

Arguments

x

a SparkDataFrame or GroupedData.

...

further arguments to be passed to or from other methods.

Value

A SparkDataFrame.

Details

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

Note

agg since 1.4.0

summarize since 1.4.0

agg since 1.4.0

summarize since 1.4.0

Examples

if (FALSE) { # \dontrun{
 df2 <- agg(df, age = "sum")  # new column name will be created as 'SUM(age#0)'
 df3 <- agg(df, ageSum = sum(df$age)) # Creates a new column named ageSum
 df4 <- summarize(df, ageSum = max(df$age))
} # }