R/lengthunique.r

Defines functions lengthunique

Documented in lengthunique

#--- Length of unique values function --#
#'@title Calculates the number of unique values in a vector
#'@description Calculates the number of unique values in a vector.
#'@author Charles Crabtree \email{ccrabtr@umich.edu}
#'@param x A vector.
#'@return The number of unique values in a vector.
#'@examples
#'x <- rep(c(1:10), 10)
#'lengthunique(x)
#'@export lengthunique

lengthunique <- function(x) {
  length(unique(x[!is.na(x)]))
}

Try the plotrr package in your browser

Any scripts or data that you put into this service are public.

plotrr documentation built on May 2, 2019, 9:36 a.m.