Validating Treatment Groupings

Dealing with uniqueness, completeness and sets

Learning Goals

  • Check if the provided columns have unique row values using rows_distinct.
  • Check if the provided columns do not have NA values using col_vals_not_null.
  • Check if the provided columns contain specific values from a given set using col_vals_in_set.

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 have no missing values using rows_distinct and pointblank::col_vals_not_null 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.