check-vector-isDuplicate: Does the input contain a duplicate value?

check-vector-isDuplicateR Documentation

Does the input contain a duplicate value?

Description

Does the input contain a duplicate value?

Usage

isDuplicate(x)

Arguments

x

vector. Any vector type (e.g. character, logical, numeric).

Details

This check is designed to serve as a complement to the base duplicated function, which only returns TRUE after the first observed duplicate value. Our check here returns TRUE for all values that are duplicated.

Value

TRUE on success; FALSE on failure, with cause set.

Functions

  • isDuplicate(): Vectorized.

Note

Updated 2023-09-29.

Examples

## TRUE ====
x <- c("a", "a", "b", "b", "c", "d")
isDuplicate(x)
duplicated(x)

## FALSE ====
isDuplicate(c("a", "b", "c"))

acidgenomics/r-goalie documentation built on Jan. 12, 2024, 4:15 a.m.