Creates a Kaplan-Meier plot with at risk tables below for survfit object.
jskm(
sfit,
table = FALSE,
table.censor = FALSE,
xlabs = "Time-to-event",
ylabs = NULL,
xlims = c(0, max(sfit$time)),
ylims = c(0, 1),
surv.scale = c("default", "percent"),
ystratalabs = NULL,
ystrataname = "Strata",
timeby = signif(max(sfit$time)/7, 1),
main = "",
pval = FALSE,
pval.size = 5,
pval.coord = c(NULL, NULL),
pval.testname = T,
marks = TRUE,
shape = 3,
med = FALSE,
legend = TRUE,
legendposition = c(0.85, 0.8),
ci = FALSE,
subs = NULL,
label.nrisk = "Numbers at risk",
size.label.nrisk = 10,
linecols = "Set1",
dashed = FALSE,
cumhaz = F,
cluster.option = "None",
cluster.var = NULL,
data = NULL,
cut.landmark = NULL,
showpercent = F,
status.cmprsk = NULL,
linewidth = 0.75,
theme = NULL,
nejm.infigure.ratiow = 0.6,
nejm.infigure.ratioh = 0.5,
nejm.infigure.ylim = c(0, 1),
surv.by = NULL,
hr = FALSE,
hr.size = 5,
hr.coord = c(NULL, NULL),
hr.testname = F,
...
)
Plot
a survfit object
logical: Create a table graphic below the K-M plot, indicating at-risk numbers?
logical: Add numbers of censored in table graphic
x-axis label
y-axis label
numeric: list of min and max for x-axis. Default = c(0,max(sfit$time))
numeric: list of min and max for y-axis. Default = c(0,1)
scale transformation of survival curves. Allowed values are "default" or "percent".
character list. A list of names for each strata. Default = names(sfit$strata)
The legend name. Default = "Strata"
numeric: control the granularity along the time-axis; defaults to 7 time-points. Default = signif(max(sfit$time)/7, 1)
plot title
logical: add the pvalue to the plot?
numeric value specifying the p-value text size. Default is 5.
numeric vector, of length 2, specifying the x and y coordinates of the p-value. Default values are NULL
logical: add '(Log-rank)' text to p-value. Default = F
logical: should censoring marks be added?
what shape should the censoring marks be, default is a vertical line
should a median line be added to the plot? Default = F
logical. should a legend be added to the plot?
numeric. x, y position of the legend if plotted. Default=c(0.85,0.8)
logical. Should confidence intervals be plotted. Default = FALSE
= NULL,
Numbers at risk label. Default = "Numbers at risk"
Font size of label.nrisk. Default = 10
Character or Character vector. Colour brewer pallettes too colour lines. Default ="Set1", "black" for black with dashed line, character vector for the customization of line colors.
logical. Should a variety of linetypes be used to identify lines. Default = FALSE
Show cumulative incidence function, Default: F
Cluster option for p value, Option: "None", "cluster", "frailty", Default: "None"
Cluster variable
select specific data - for reactive input, Default = NULL
cut-off for landmark analysis, Default = NULL
Shows the percentages on the right side.
Status value when competing risk analysis, Default = 2nd level of status variable
Line witdh, Default = 0.75
Theme of the plot, Default = NULL, "nejm" for NEJMOA style, "jama" for JAMA style
Ratio of infigure width to total width, Default = 0.6
Ratio of infigure height to total height, Default = 0.5
y-axis limit of infigure, Default = c(0,1)
breaks unit in y-axis, default = NULL(ggplot default)
logical: add the hazard ratio to the plot?
numeric value specifying the HR text size. Default is 5.
numeric vector, of length 2, specifying the x and y coordinates of the p-value. Default values are NULL
logical: add '(Log-rank)' text to p-value. Default = F
PARAM_DESCRIPTION
Jinseob Kim, but heavily modified version of a script created by Michael Way. https://github.com/michaelway/ggkm/ I have packaged this function, added functions to namespace and included a range of new parameters.
DETAILS
library(survival)
data(colon)
fit <- survfit(Surv(time, status) ~ rx, data = colon)
jskm(fit, timeby = 500)
Run the code above in your browser using DataLab