Skip to contents

This function is used to check for any duplicated records in a dataset based on the combination of provided columns.

Usage

check_duplicate_records(
  .data,
  col_names,
  stop_message = TRUE,
  return_duplicate_record = FALSE,
  extra_cols = NULL
)

Arguments

.data

Data.frame

col_names

Character vector of column names

stop_message

A Boolean value to return a stop message if there is any duplicated records, Default: `TRUE`

return_duplicate_record

A Boolean value to return any duplicated records, Default: `FALSE`

extra_cols

Additional columns that will be returned if `stop_message` is `FALSE`

Value

The same data.frame as input dataset if there is not any duplicated records. Otherwise either an assert stop message or duplicated records.

Examples

if (FALSE) { # \dontrun{
check_duplicate_records(
  dd = ADNIMERGE2::QS,
  col_names = c("USUBJID", "QSDTC", "QSTESTCD"),
  stop_message = TRUE,
  add_cols = NULL
)
} # }