Provide a data.frame along with any number of column names that exist in the data and see if all rows are distinct. Can be useful when checking for duplicates.

is_distinct(.df, .cols)

Arguments

.df

A data.frame

.cols

List of column names to perform check on

Examples

duplicate_df <- 
  dplyr::tibble(
    ID = c(1, 1, 2, 2),
    EVID = c(0, 1, 1, 1),
    TIME = c(-0.5, 1, 1, 1))

is_distinct(.df = duplicate_df, .cols = c("EVID", "TIME"))
#> [1] FALSE