R/uniquelen.R

Defines functions unique_len

Documented in unique_len

#' Combine unique() and length()
#'
#' Combine two frequently used function together to return the length of the unique items of a vector
#'
#' @param . object such as vector or names(dataframe)
#' @return length of the unique items in a vector
#'
#' @examples
#' frenchnames1 = c("Léa","Obinna","Bastien","Léa","Obinna", "Hugo", "Amélie","Louis")
#' unique_len(frenchnames1)
#'
#' @export

unique_len <- function(.){
  length(unique(.))
}

Try the quickcode package in your browser

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

quickcode documentation built on April 11, 2025, 5:49 p.m.