Signal Duplicate Records
signal_duplicate_records(
dataset,
by_vars,
msg = paste("Dataset contains duplicate records", "with respect to",
"{.var {replace_values_by_names(by_vars)}}"),
cnd_type = "error",
class = NULL
)Input dataset
The variables specified by the by_vars argument are expected to be in the dataset.
none
Grouping variables
Defines groups of records in which to look for duplicates.
list of variables created by exprs(), e.g., exprs(USUBJID, VISIT)
none
The condition message
paste("Dataset contains duplicate records", "with respect to",
"{.var {replace_values_by_names(by_vars)}}")
Type of condition to signal when detecting duplicate records.
"message", "warning", or "error"
"error"
Class of the condition
The specified classes are added to the classes of the condition.
c("duplicate_records", "assert-admiral") is always added.
NULL
No return value, called for side effects
Other internal:
admiral-package,
extract_duplicate_records(),
format.basket_select()
data(admiral_adsl)
# Duplicate the first record
adsl <- rbind(admiral_adsl[1L, ], admiral_adsl)
signal_duplicate_records(adsl, exprs(USUBJID), cnd_type = "message")
#> Dataset contains duplicate records with respect to `USUBJID`
#> ℹ Run `admiral::get_duplicates_dataset()` to access the duplicate records