Learn R Programming

rmngb (version 0.6-1)

nDistinct: Number of Distinct Elements

Description

Count the number of distinct elements in a vector or a matrix.

Usage

nDistinct(x)

Arguments

x
a vector or a matrix.

Value

A scalar giving te number of distinct elements in x.

Examples

Run this code
nDistinct(c(1, 3, 3, 5))

Run the code above in your browser using DataLab