check_no_duplicates_in_group {vvauditor} | R Documentation |
Check for No Duplicates in Group
Description
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.
Usage
check_no_duplicates_in_group(
dataframe,
group_variables = NULL,
assertion_fail = "stop"
)
Arguments
dataframe |
The dataframe to be checked. |
group_variables |
The group variables as a character vector. The default is NULL. |
assertion_fail |
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. |
See Also
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()
Examples
# 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)
[Package vvauditor version 0.6.0 Index]