chk_duplicate: Audits values in columns for duplicate values.

Description Usage Arguments Value Examples

View source: R/duplicate_checks.R

Description

Among other things, uses assertr::is_uniq.

Usage

1
chk_duplicate(.data, .variables)

Arguments

.data

Data to audit.

.variables

Column variables to check.

Value

Adds attribute that contains the audit errors, if any, to the data. Use aud_report() to view the audit fails.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
library(magrittr)

# dataset with one duplicate value between id and time
ds <- data.frame(
id = c(rep(1:3, each = 2), 3),
time = c(rep(1:2, times = 3), 1)
)
ds

flaws <- chk_duplicate(ds, c("id", "time"))
aud_report(flaws) # Should be one

flaws <- chk_duplicate(ds, c("id"))
aud_report(flaws) # Should be all of them

lwjohnst86/PROMISE.audit documentation built on May 6, 2019, 9:54 a.m.