R: Test for uniquenes of records

is_unique {validate} | R Documentation

## Test for uniquenes of records

### Description

Utility function to make common tests easier.

### Usage

    is_unique(...)

    all_unique(...)

### Arguments

`...` | When used in a validation rule: a bare (unquoted) list of variable names. When used directly, a comma-separated list of vectors of equal length.

### Value

For `is_unique` A logical vector that is `FALSE` for each record that has a duplicate.

For `all_unique` a single `TRUE` or `FALSE`.

### See Also

Other cross-record-helpers: `exists_any()`, `is_complete()`

### Examples

    d <- data.frame(X = c('a','b','c','b'), Y = c('banana','apple','banana','apple'), Z=1:4)
    v <- validator(is_unique(X, Y))
    values(confront(d, v))

[Package validate version 0.9.3 Index]