count {SparkR}R Documentation

Returns the number of items in a group

Description

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

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

Usage

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

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

count(x)

n(x)

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

Arguments

x

a GroupedData or Column.

Value

A SparkDataFrame.

Note

count since 1.4.0

n since 1.4.0

count since 1.4.0

See Also

Other agg_funcs: agg, agg, agg, agg,GroupedData-method, agg,SparkDataFrame-method, summarize, summarize, summarize, summarize,GroupedData-method, summarize,SparkDataFrame-method; avg, avg, avg,Column-method; countDistinct, countDistinct, countDistinct,Column-method, n_distinct, n_distinct, n_distinct,Column-method; first, first, first, first,SparkDataFrame-method, first,characterOrColumn-method; kurtosis, kurtosis, kurtosis,Column-method; last, last, last,characterOrColumn-method; max, max,Column-method; mean, mean,Column-method; min, min,Column-method; sd, sd, sd,Column-method, stddev, stddev, stddev,Column-method; skewness, skewness, skewness,Column-method; stddev_pop, stddev_pop, stddev_pop,Column-method; stddev_samp, stddev_samp, stddev_samp,Column-method; sumDistinct, sumDistinct, sumDistinct,Column-method; sum, sum,Column-method; var_pop, var_pop, var_pop,Column-method; var_samp, var_samp, var_samp,Column-method; var, var, var,Column-method, variance, variance, variance,Column-method

Examples

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

[Package SparkR version 2.2.0 Index]