Description Usage Arguments Details
View source: R/qplot_survival_p.R
for a covariate x and survival, break x into groups and plot KM curves
1 2 3 4 5 6 7 8 9 | ggKM(x, OS, OScensoring, breaks, labels, use_dichotomizeExpr = FALSE,
par_dichotomizeExpr = list(method = "quantile", q1 = NA, q2 = NA, Lower =
NULL, Upper = NULL, labels = c("Low", "High"), level_labels = c("Low",
"High"), plot = FALSE), legendTitle, nrowL = NA, main, cex.main = 0.8,
tag, xlab = "Survival time", ylab = "Survival probability", cols,
legend_within = TRUE, lx = 0.8, ly = 0.88, xlim = NULL,
theme_bg = theme_base(), sizeaxis = 12, sizeaxistitlerel = 1.2,
sizetitlerel = 0.8, plot = TRUE, addEventCount = F,
rmMissingEarly = TRUE)
|
x |
a continuous variable |
OS |
survival time |
OScensoring |
censoring status, 1 is event |
labels |
labels for each broken categories, corresponding to values (intervals) from small to large |
use_dichotomizeExpr |
whether to use dichotomizeExpr to dichotomize the data; when this is activated, cut is inactivated |
par_dichotomizeExpr |
a list of parameters passed to dichotomizeExpr |
legendTitle |
legend title name |
nrowL |
legend row number |
main |
title |
tag |
a tag added at the start of title |
xlab |
x label |
ylab |
y label |
cols |
either a named vector (names from x) to accurately specify the color or a color vecto which is to be input in the alphabetical order as the x values |
legend_within |
whether to put legend within the figure |
lx |
relative x position of legend (between 0~1) |
ly |
relative y position of legend (between 0~1) |
theme_bg |
background theme |
addEventCount |
addEventCount whether to add event count in the legend |
updated on 2014/03/13: when x is missing, this means just plot KM for OS. This implementation is built upon plotKMcat. That is, we first breaks the continuous variable to categorical and feed it into plotKMcat(). How is the color decided; how does it corresponds to the broken intervals? This is actually decidied by plotKMcat() which use aes(group, colour) to make sure color and group are correct. The labels in categorical variable is the label in legend to make sure we're safe. If one want to change this, just manipulate the categorical variable. For the continuous variable, we can just specify the labels in the order of resulting increasing intervals from cut().
updated on 2016/01/08: breaks and labels works with cut and good for >2 groups; However, sometimes dichotomized group for extreme values is needed (using dichotomizeExpr). To fully use use_dichotomizeExpr, we add use_dichotomizeExpr to indicate if this function is activated and use par_dichotomizeExpr as a list to hold all parameters passed to it.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.