Usage
expand_to_long(
data,
id_col = "id",
arm_col = "arm",
start_col = "start_month",
end_col = "end_month",
died_col = "died",
bc_died_col = "bc_died",
bc_month_col = "bc_month"
)
Details
The binary outcome variable dead_t1 encodes whether the participant died in the interval from month t to month t+1:
For participants who died:
-
Rows span from start_month to end_month - 1.
-
The last row (at end_month - 1) has dead_t1 = 1.
-
No row is created for end_month.
For censored or surviving participants:
-
Rows span from start_month to end_month.
-
The last row (at end_month) has dead_t1 = NA.
-
All prior rows have dead_t1 = 0.
If a participant died in the same month they entered the study (end_month == start_month and died == 1), dead_t1 is set to NA (outcome indeterminate within a single month).
The breast-cancer-specific outcome bc_dead_t1 mirrors dead_t1 but is set to 0 at the event row when the death was not attributed to breast cancer (bc_died == 0).