https://github.com/hadley/dplyr
Raw File
Tip revision: 1f57c48a765ad60837ffed1fe0572c40f4b7a3de authored by hadley on 09 January 2015, 12:35:47 UTC
Merge branch 'master' of github.com:hadley/dplyr
Tip revision: 1f57c48
n_distinct.Rd
% Generated by roxygen2 (4.1.0): do not edit by hand
% Please edit documentation in R/RcppExports.R
\name{n_distinct}
\alias{n_distinct}
\title{Efficiently count the number of unique values in a vector.}
\usage{
n_distinct(x)
}
\arguments{
\item{x}{a vector of values}
}
\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