as_pfs_os {hesim} | R Documentation |
Convert multi-state data to PFS and OS data
Description
Convert a multi-state dataset with irreversible transitions containing 3 health states to a dataset with one row per patient and progression-free survival (PFS) and overall survival (OS) time-to-event outcomes.
Usage
as_pfs_os(
data,
patient_vars,
status = "status",
time_stop = "time_stop",
transition = "transition_id"
)
Arguments
data |
A multi-state dataset. |
patient_vars |
Character vector of the names of patient specific variables. |
status |
Character string with the name of the status variable (1 = event, 0 = censored). |
time_stop |
Character string with the name of the stopping time variable
(i.e., time patient transitions from state |
transition |
Character string with the name of the variable identifying a transition. The transition variable should be integer valued with values 1, 2, and 3 for the Stable -> Progression, Stable -> Death, and Progression -> Death transitions, respectively. |
Value
A data.table
with one row per patient containing each variable in
patient_vars
as well as a time variable and status indicator for both
PFS (pfs_status
, pfs_time
) and OS (os_time
, os_status
).
Examples
as_pfs_os(onc3, patient_vars = c("patient_id", "strategy_name", "female", "age"))