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 agg_funcs: agg, avg, countDistinct, first, kurtosis, last, max, mean, min, sd, skewness, stddev_pop, stddev_samp, sumDistinct, sum, var_pop, var_samp, var

Examples

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

[Package SparkR version 2.1.2 Index]