Learn R Programming

eq5dsuite (version 1.0.1)

.check_uniqueness: Check the uniqueness of groups This function takes a data frame `df` and a vector of columns `group_by`, and checks whether the combinations of values in the columns specified by `group_by` are unique. If the combinations are not unique, a warning message is printed.

Description

Check the uniqueness of groups This function takes a data frame `df` and a vector of columns `group_by`, and checks whether the combinations of values in the columns specified by `group_by` are unique. If the combinations are not unique, a warning message is printed.

Usage

.check_uniqueness(df, group_by)

Value

No return value, called for side effects: it will stop with an error if any group combinations are not unique.

Arguments

df

A data frame.

group_by

A character vector of column names in `df` that specify the groups to check for uniqueness.

Examples

Run this code
df <- data.frame(id = c(1, 1, 1, 1, 2, 2),
                 fu = rep(c("baseline", "follow-up"), 3),
                 value = rnorm(6))
.check_uniqueness(df, c("id", "fu"))

Run the code above in your browser using DataLab