countDistinct {SparkR}R Documentation

Count Distinct Values


Count Distinct Values

Aggregate function: returns the number of distinct items in a group.


## S4 method for signature 'Column'
countDistinct(x, ...)

## S4 method for signature 'Column'
n_distinct(x, ...)

countDistinct(x, ...)

n_distinct(x, ...)



Column to compute on


other columns


the number of distinct items in a group.


countDistinct since 1.4.0

n_distinct 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; count, count, count,Column-method, count,GroupedData-method, n, n, n,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


## Not run: countDistinct(df$c)
## Not run: n_distinct(df$c)

[Package SparkR version 2.0.2 Index]