Skip to contents

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

Usage

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

Arguments

events

A data frame with columns for treatment name, treatment start and stop dates, plus a column for unique patient identifiers.

gap

Maximum number of days between intervals before they are considered distinct episodes. Intervals separated by gap or fewer days are merged into a single contiguous episode.

Default value: 0L

id_var

A string specifying the patient identifier column in events.

Default value: "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 contains no overlapping intervals for the same treatment -- the behavior of interval combining is dependent on this assertion.