count {SparkR}R Documentation

Count

Description

Count the number of rows for each group when we have GroupedData input. The resulting SparkDataFrame will also contain the grouping columns.

This can be used as a column aggregate function with Column as input, and returns the number of items in a group.

Usage

count(x)

n(x)

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

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

## S4 method for signature 'Column'
n(x)

Arguments

x

a GroupedData or Column.

Value

A SparkDataFrame.

Note

count since 1.4.0

count since 1.4.0

n since 1.4.0

See Also

Other aggregate functions: avg(), column_aggregate_functions, corr(), cov(), first(), last()

Examples

## Not run: 
##D   count(groupBy(df, "name"))
## End(Not run)
## Not run: count(df$c)
## Not run: n(df$c)

[Package SparkR version 3.0.2 Index]