Create a class of regimen. A regimen defines the rules to select treatments for patients switch, to determine the time of switching, and to update patients' endpoint data.
Methods
Method new()
initialize regimen
Usage
Regimens$new(what, when, how, ...)Arguments
whata function determining whether patients' data would be updated due to switching treatment. It takes
patient_data, a data frame as argument, and returns a data frame of two columnspatient_idandnew_treatment. Patients withNAinnew_treatmentwill be skipped. The number of rows in the returned data frame may be smaller than the number of patients in the input data frame. This indicates that some patients' data will not be modifier. Note that the returned object will be passed into function `how()`, which is also provide by users. This argument can also be a list of functions that will be executed sequentially. No default value.whena function determining the time at which a patient switches to another treatment regimen, measured from the time of enrollment. It takes
patient_data, a data frame as argument, and returns a data frame of two columnspatient_idandswitch_time(fromenroll_time). NoNAis allowed inswitch_timeand the number of rows in the returned data frame must equal the number of rows inpatient_data, i.e., switching time must be specified to every patients. Note that the returned object will be passed into function `how()`, which is also provided by users. This argument can also be a list of functions that will be executed sequentially. No default value.howa function updating patients' data after treatment switching. Only modified columns and
patient_idare returned. A cell will be omitted ifNA, meaning no change to that patient for the endpoint or other variables. Equivalently, users can also fill the cell with its original value. This argument can also be a list of functions that will be executed sequentially. No default value....(optional) named arguments routed to one or more of
what,when, andhow.
