Learn R Programming

whatifbandit (version 0.3.0)

create_conditions: Creating proper conditions vector

Description

This function creates a character vector of treatment conditions using the conditions column in the provided data, and if control_augment is greater than 0, it also labels the control condition. Throws an error of control_condition is not present.

Usage

create_conditions(control_condition, data, condition_col, control_augment)

Value

Character vector of unique treatment conditions. Throws error if an invalid specification is used.

Arguments

control_condition

Value of the control condition. Only necessary when control_augment is greater than 0. Internally this value is coerced to a string, so it should be passed as a string, or a type that can easily be converted to a string.

data

A data.frame, data.table, or tibble containing input data from the trial. This should be the results of a traditional Randomized Controlled Trial (RCT). Any data.frames will be converted to tibbles internally.

condition_col

Column in data; original treatment condition for each observation.

control_augment

A numeric value ranging from 0 to 1; proportion of each wave guaranteed to receive the "Control" treatment. Default is 0. It is not recommended to use this in conjunction with random_assign_prop.