check_no_duplicates_in_group.Rd
This function checks if there is exactly one row per group in the provided dataframe. If there are multiple rows per group, the assertion fails.
check_no_duplicates_in_group(
dataframe,
group_variables = NULL,
assertion_fail = "stop"
)
The dataframe to be checked.
The group variables as a character vector. The default is NULL.
How the function reacts to a failure. This can be a "warning", where only a warning is given on the failure, or a "stop", where the function execution is stopped and the message is displayed, or an "AssertCollection", where the failure message is added to an assertion collection.
Other assertions:
check_numeric_or_integer_type()
,
check_posixct_type()
Other tests:
check_double_columns()
,
check_numeric_or_integer_type()
,
check_posixct_type()
,
duplicates_in_column()
,
test_all_equal()
# Create a dataframe with some groups having more than one row
dataframe <- data.frame(a = c(1, 1, 2), b = c(2, 2, 3), c = c("x", "x", "y"))
# Check the uniqueness of rows per group
check_no_duplicates_in_group(dataframe)