# n_distinct

From dplyr v0.5.0
by Hadley Wickham

##### Efficiently count the number of unique values in a set of vector

This is a faster and more concise equivalent of `length(unique(x))`

##### Usage

`n_distinct(..., na.rm = FALSE)`

##### Arguments

- na.rm
id

`TRUE`

missing values don't count- …
vectors of values

##### Examples

`library(dplyr)`

```
x <- sample(1:10, 1e5, rep = TRUE)
length(unique(x))
n_distinct(x)
```

*Documentation reproduced from package dplyr, version 0.5.0, License: MIT + file LICENSE*

### Community examples

Looks like there are no examples yet.