Combines censoring and absorbing variables to determine the min of their occurrence and labels for Sankeys. Converts filter variables if they are not factors.

setup_cohort(
  cohort,
  id_var,
  censor_vars,
  absorbing_vars,
  index_var,
  filt_vars,
  final_stage,
  weight
)

Arguments

cohort

Cohort data.

id_var

String. Variable name of the id/grouping variable.

censor_vars

Character vector. Variable names in cohort that indicate censoring date/day. If multiple, sankey_list_maker will use the minimum. If weight = FALSE the Sankey will use the names of the vector to label the states shown. If unnamed will group together under "Censored".

absorbing_vars

Named character vector. Variables in cohort that indicate date/day of states that members cannot transition out of. Names of the vector will be names of the states shown in the Sankey.

index_var

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

filt_vars

All variables that are wanted for filtering.

final_stage

Last timepoint for the Sankeys

weight

Logical. Should Sankey transitions be weighted? Default is FALSE.

Value

tibble with information necessary for Sankey setup.