This function asserts that there are no duplicate rows in the specified columns of a data frame. It groups the data frame by the specified columns, counts the number of unique values for each group, and checks if there are any groups with more than one row. If there are, it prints an error message and stops the execution (unless assertion_fail is set to "warn").

assert_no_duplicates_in_group(df, group_vars, assertion_fail = "stop")

Arguments

df

A data frame.

group_vars

A character vector of column names.

assertion_fail

A character string indicating the action to take if the assertion fails. Can be "stop" (default) or "warn".

Value

The input data frame.