Validating Treatment Groupings

Dealing with uniqueness, completeness and sets

Consider this small data set treatment_group_dataset consisting of the patient’s treatment group in a clinical trial to understand the treatment effects of a pharmaceutical compound.

Check if patient ID is unique and complete

We verify if the values in the column Patient ID are unique and complete using rows_distinct and rows_complete respectively.

Check if all patients are given a treatment group

In this data set, a patient can only be assigned to either the Placebo or Treatment group. To verify this, we use the function col_vals_in_set. A new parameter to take note is set which we need to specify the relevant groups the column needs to have. This is done by setting set = c("Placebo", "Treatment").

Here is an example (using columns Balanced Grouping and Imbalanced Grouping) when the verification has no error.

The column Invalid Grouping has patients which do not pass the validation.

We can use create_agent(), interrogate() and get_sundered_data() to obtain patients with issues.

We can see that the patients that do not meet the criteria have either missing data or spelling mistakes.