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{[email protected]}
#'@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 Dec. 5, 2017, 1:05 a.m.