Convert ansible data to sankey id timed data

sankey_id_ansible(
  cohort,
  data,
  stages,
  id_var = "patient_id",
  index_var = "index_date",
  states = NULL,
  select_event = "combine"
)

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.

stages

Numeric. Timepoints after index to evalute treatment states.

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.

states

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

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.

Value

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