h_km_layout | R Documentation |
Prepares a (5 rows) x (2 cols) layout for the Kaplan-Meier curve.
h_km_layout(
data,
g_el,
title,
footnotes,
annot_at_risk = TRUE,
annot_at_risk_title = TRUE
)
data |
( |
g_el |
( |
title |
( |
footnotes |
( |
annot_at_risk |
( |
annot_at_risk_title |
( |
The layout corresponds to a grid of two columns and five rows of unequal dimensions. Most of the dimension are fixed, only the curve is flexible and will accommodate with the remaining free space.
The left column gets the annotation of the ggplot
(y-axis) and the names of the strata for the patient
at risk tabulation. The main constraint is about the width of the columns which must allow the writing of
the strata name.
The right column receive the ggplot
, the legend, the x-axis and the patient at risk table.
A grid layout.
library(dplyr)
library(survival)
library(grid)
fit_km <- tern_ex_adtte %>%
filter(PARAMCD == "OS") %>%
survfit(formula = Surv(AVAL, 1 - CNSR) ~ ARMCD, data = .)
data_plot <- h_data_plot(fit_km = fit_km)
xticks <- h_xticks(data = data_plot)
gg <- h_ggkm(
data = data_plot,
censor_show = TRUE,
xticks = xticks, xlab = "Days", ylab = "Survival Probability",
title = "tt", footnotes = "ff", yval = "Survival"
)
g_el <- h_decompose_gg(gg)
lyt <- h_km_layout(data = data_plot, g_el = g_el, title = "t", footnotes = "f")
grid.show.layout(lyt)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.