We will use the cadtte data set from the random.cdisc.data package to create the survival forest graph. We start by filtering the adtte data set for the overall survival observations, converting time of overall survival to months, creating a new variable for event information, binarizing the ARM variable and creating a binned age variable by using the function cut_quantile_bins(). Note that we do not include the boundaries 0 and 1 in the corresponding cutoffs vector AGE_probs, but only the true cutoff probabilities to use (here 0.5, i.e. the median). We restrict the analysis of the biomarker variables BMRKR1 and BMRKR2 to the BEP by setting them as missing for the non-BEP.
We also relabel the biomarker evaluable population flag variable BEP01FL and the categorical biomarker variable BMRKR2 to update the display label of these variables in the graph.
This works analogously to SFG1, we just specify different factor variables in subgroups, here including the binned continuous variable AGE_BIN as well as SEX.
---title: SFG1Bsubtitle: Survival Forest Graph Only by Binned Continuous Variablecategories: [SFG]---------------------------------------------------------------------------::: panel-tabset{{< include setup.qmd >}}## PlotThis works analogously to [SFG1](sfg01.qmd), we just specify different factor variables in `subgroups`, here including the binned continuous variable `AGE_BIN` as well as `SEX`.```{r}tbl <-extract_survival_subgroups(variables =list(tte ="AVAL",is_event ="is_event",arm ="ARM_BIN",subgroups =c("SEX", "AGE_BIN") ),data = adtte)result <-basic_table() %>%tabulate_survival_subgroups(df = tbl,vars =c("n_tot_events", "n", "n_events", "median", "hr", "ci"),time_unit = adtte$AVALU[1] )```We can now produce the forest plot using `g_forest()`.```{r, fig.width = 15}g_forest(result)```{{< include ../../misc/session_info.qmd >}}:::