https://github.com/hadley/dplyr
Raw File
Tip revision: e47f9c95d2b5c6e782ce3a6ac250b5c4a1ed9e08 authored by Kirill Müller on 09 May 2018, 07:57:34 UTC
Merge pull request #3563 from krlmlr/h-ubsan
Tip revision: e47f9c9
n_distinct.Rd
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/distinct.R
\name{n_distinct}
\alias{n_distinct}
\title{Efficiently count the number of unique values in a set of vector}
\usage{
n_distinct(..., na.rm = FALSE)
}
\arguments{
\item{\dots}{vectors of values}

\item{na.rm}{if \code{TRUE} missing values don't count}
}
\description{
This is a faster and more concise equivalent of \code{length(unique(x))}
}
\examples{
x <- sample(1:10, 1e5, rep = TRUE)
length(unique(x))
n_distinct(x)
}
back to top