Usage
h_ggkm(
data,
xticks = NULL,
yval = "Survival",
censor_show,
xlab,
ylab,
ylim = NULL,
title,
footnotes = NULL,
max_time = NULL,
lwd = 1,
lty = NULL,
pch = 3,
size = 2,
col = NULL,
ci_ribbon = FALSE,
ggtheme = nestcolor::theme_nest()
)
Arguments
- data
(
data.frame
)
survival data as pre-processed byh_data_plot
.- xticks
(
numeric
,number
, orNULL
)
numeric vector of ticks or single number with spacing between ticks on the x axis. IfNULL
(default),labeling::extended()
is used to determine an optimal tick position on the x axis.- yval
(
string
)
value of y-axis. Options areSurvival
(default) andFailure
probability.- censor_show
(
flag
)
whether to show censored.- xlab
(
string
)
label of x-axis.- ylab
(
string
)
label of y-axis.- ylim
(
vector
ofnumeric
)
vector of length 2 containing lower and upper limits for the y-axis. IfNULL
(default), the minimum and maximum y-values displayed are used as limits.- title
(
string
)
title for plot.- footnotes
(
string
)
footnotes for plot.- max_time
(
numeric
)
maximum value to show on X axis. Only data values less than or up to this threshold value will be plotted (defaults toNULL
).- lwd
(
numeric
)
line width. Length of a vector should be equal to number of strata fromsurvival::survfit()
.- lty
(
numeric
)
line type. Length of a vector should be equal to number of strata fromsurvival::survfit()
.- pch
(
numeric
,string
)
value or character of points symbol to indicate censored cases.- size
(
numeric
)
size of censored point, a class ofunit
.- col
(
character
)
lines colors. Length of a vector should be equal to number of strata fromsurvival::survfit()
.- ci_ribbon
(
flag
)
draw the confidence interval around the Kaplan-Meier curve.- ggtheme
(
theme
)
a graphical theme as provided byggplot2
to control outlook of the Kaplan-Meier curve.
Examples
# \donttest{
library(dplyr)
library(survival)
fit_km <- tern_ex_adtte %>%
filter(PARAMCD == "OS") %>%
survfit(form = 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",
yval = "Survival",
ylab = "Survival Probability",
title = "Survival"
)
gg
# }