Convert ansible data to sunburst id ordered data

sunburst_id_data(
  cohort,
  data,
  id_var = "patient_id",
  index_var = "index_date",
  end_of_study = "censor_date",
  states = NULL,
  trt_holiday = NULL,
  select_event = "combine",
  combine_repeats = T
)

Arguments

cohort

A tibble. Cohort file with one record per subject.

data

A tibble. Events file with one record per mutually exclusive time interval per subject. Return object from ansible.

id_var

String. Variable name of the id/grouping variable.

index_var

Date. Indicates cohort_file date variable name per subject when event ordering should begin.

end_of_study

Date. Indicates cohort_file date variable name per subject when event ordering should end.

states

Character. Treatment states to include in sunburst. Default NULL uses all treatments in data.

trt_holiday

Numeric. Indicates minimum span of days to consider a "None" state (i.e. if we are only interested in treatment holidays of longer than x number of days). Default NULL preserves all gaps of treatment.

select_event

Character. How should events be selected at each time point? Default "combine" returns all events that occurred at the time point. "first" takes the first event, "last" takes the last (most recent) event.

combine_repeats

Logical. Combine identical states that occur in sequence? Default is TRUE.

Value

List with id data and states used to make the numeric.