SparkR (version 2.1.2)

countDistinct: Count Distinct Values

Description

Count Distinct Values

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

Usage

countDistinct(x, ...)

n_distinct(x, ...)

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

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

Arguments

x

Column to compute on

...

other columns

Value

the number of distinct items in a group.

See Also

Other agg_funcs: agg, avg, count, first, kurtosis, last, max, mean, min, sd, skewness, stddev_pop, stddev_samp, sumDistinct, sum, var_pop, var_samp, var

Examples

Run this code
# NOT RUN {
countDistinct(df$c)
# }
# NOT RUN {
n_distinct(df$c)
# }

Run the code above in your browser using DataCamp Workspace