Prepare survival data for population subgroups in data frames
Source:R/survival_duration_subgroups.R
extract_survival_subgroups.Rd
Prepares estimates of median survival times and treatment hazard ratios for population subgroups in
data frames. Simple wrapper for h_survtime_subgroups_df()
and h_coxph_subgroups_df()
. Result is a list
of two data.frame
s: survtime
and hr
. variables
corresponds to the names of variables found in data
,
passed as a named list
and requires elements tte
, is_event
, arm
and optionally subgroups
and strata
.
groups_lists
optionally specifies groupings for subgroups
variables.
Usage
extract_survival_subgroups(
variables,
data,
groups_lists = list(),
control = control_coxph(),
label_all = "All Patients"
)
Arguments
- variables
(named
list
ofstring
)
list of additional analysis variables.- data
(
data.frame
)
the dataset containing the variables to summarize.- groups_lists
(named
list
oflist
)
optionally contains for eachsubgroups
variable a list, which specifies the new group levels via the names and the levels that belong to it in the character vectors that are elements of the list.- control
-
(
list
)
parameters for comparison details, specified by using the helper functioncontrol_coxph()
. Some possible parameter options are:pval_method
(string
)
p-value method for testing hazard ratio = 1. Default method is"log-rank"
which comes fromsurvival::survdiff()
, can also be set to"wald"
or"likelihood"
(fromsurvival::coxph()
).ties
(string
)
specifying the method for tie handling. Default is"efron"
, can also be set to"breslow"
or"exact"
. See more insurvival::coxph()
conf_level
(proportion
)
confidence level of the interval for HR.
- label_all
(
string
)
label for the total population analysis.
Value
A named list
of two elements:
survtime
: Adata.frame
containing columnsarm
,n
,n_events
,median
,subgroup
,var
,var_label
, androw_type
.hr
: Adata.frame
containing columnsarm
,n_tot
,n_tot_events
,hr
,lcl
,ucl
,conf_level
,pval
,pval_label
,subgroup
,var
,var_label
, androw_type
.