R/any_duplicated.R

Defines functions any_duplicated

Documented in any_duplicated

#' Function to test if a vector contains duplicate elements. 
#' 
#' Unlike \code{\link{anyDuplicated}} which returns the index value of the first
#' duplicated element, \code{any_duplicated} is simpler and returns a logical
#' vector. 
#' 
#' @author Stuart K. Grange
#' 
#' @param x A vector to test for duplicate elements.
#' 
#' @return Logical vector with a length of \code{1}. 
#' 
#' @export
any_duplicated <- function(x) {
  if_else(anyDuplicated(x) == 0L, FALSE, TRUE)
}
skgrange/threadr documentation built on May 11, 2024, 12:16 p.m.