agg {SparkR}R Documentation

Count

Description

Count the number of rows for each group. The resulting DataFrame will also contain the grouping columns.

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

Usage

agg(x, ...)

summarize(x, ...)

## S4 method for signature 'GroupedData'
count(x)

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

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

Arguments

x

a GroupedData

x

a GroupedData

Details

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

Value

a DataFrame

a DataFrame

Examples

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

[Package SparkR version 1.4.0 Index]