Convert a patient-level right-censored survival dataset
from a randomized 2-arm trial into the standardized format
used by retrogroup.
Arguments
- data
Data frame with one row per patient. Must have the columns named by
arm,time, andevent. Other columns are ignored.- arm
Character string, name of the column in
datawith the treatment arm. Must have no missing values and exactly two unique values.- treatment
The value of
data[[arm]]that denotes the treatment arm. The other value denotes the control arm.- time
Character string, name of the column in
datawith the time since randomization of the event or censoring. The column must be numeric, finite, non-negative, and free of missing values.- event
Character string, name of the column in
datawith the event indicator:1orTRUEfor an event,0orFALSEfor right censoring. Must have no missing values and at least one event.
Value
A tibble with one row per patient and the following columns:
treatment: integer,1for the treatment arm and0for the control arm.time: numeric, time since randomization of the event or censoring.event: integer,1if the event occurred and0if censored.
See also
Other data:
group_data_events(),
group_data_summary()
Examples
data <- group_example_patient()
group_data_patient(
data,
arm = "arm",
treatment = "Lev+5FU",
time = "time",
event = "event"
)
#> # A tibble: 619 × 3
#> treatment time event
#> <int> <dbl> <int>
#> 1 1 1521 1
#> 2 1 3087 0
#> 3 0 963 1
#> 4 1 293 1
#> 5 0 659 1
#> 6 1 1767 1
#> 7 0 3192 0
#> 8 1 3308 0
#> 9 1 3309 0
#> 10 0 2085 1
#> # ℹ 609 more rows
