powered by
Checks that the combination of specified columns has unique values. This is a point-in-time assertion that either passes silently or fails.
lock_unique(.data, ..., .strict = FALSE)
Invisibly returns .data (for piping).
.data
A data frame.
Column names (unquoted) to check for uniqueness.
If TRUE, error on failure. If FALSE (default), warn.
TRUE
FALSE
df <- data.frame(id = 1:3, x = c("a", "b", "c")) lock_unique(df, id) # Fails with warning df2 <- data.frame(id = c(1, 1, 2), x = c("a", "b", "c")) lock_unique(df2, id)
Run the code above in your browser using DataLab