Convert data in the traditional format (one state per interval) to mutually exclusive intervals that hold all the states that overlap for that interval.

ansible(events, states = NULL, gap = 1L, id_var = "patient_id", stockpile = T)

Arguments

events

Event file

states

Events of interest in the data. If NULL, assume all events are of interest.

gap

Gap (in days) to apply in prescriptions of the same type. Useful when the gap should only apply to link together identical states (if the allowable gap is to be applied universally, can be added to end prior to using the function)

id_var

Group identifier in the data. Default is patient_id

stockpile

Do identical events within a group need to be combined such that all intervals are mutually exclusive? Default is TRUE. Only turn to FALSE if you are CERTAIN the data does not need to be stockpiled--the behavior of interval combining is dependent on this assertion.