jskm: Creates a Kaplan-Meier plot for survfit object.

Description Usage Arguments Details Value Author(s) Examples

View source: R/jskm.R

Description

Creates a Kaplan-Meier plot with at risk tables below for survfit object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
jskm(
  sfit,
  table = FALSE,
  xlabs = "Time-to-event",
  ylabs = "Survival probability",
  xlims = c(0, max(sfit$time)),
  ylims = c(0, 1),
  surv.scale = c("default", "percent"),
  ystratalabs = names(sfit$strata),
  ystrataname = "Strata",
  timeby = signif(max(sfit$time)/7, 1),
  main = "",
  pval = FALSE,
  pval.size = 5,
  pval.coord = c(NULL, NULL),
  pval.testname = F,
  marks = TRUE,
  shape = 3,
  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,
  ...
)

Arguments

sfit

a survfit object

table

logical: Create a table graphic below the K-M plot, indicating at-risk numbers?

xlabs

x-axis label

ylabs

y-axis label

xlims

numeric: list of min and max for x-axis. Default = c(0,max(sfit$time))

ylims

numeric: list of min and max for y-axis. Default = c(0,1)

surv.scale

scale transformation of survival curves. Allowed values are "default" or "percent".

ystratalabs

character list. A list of names for each strata. Default = names(sfit$strata)

ystrataname

The legend name. Default = "Strata"

timeby

numeric: control the granularity along the time-axis; defaults to 7 time-points. Default = signif(max(sfit$time)/7, 1)

main

plot title

pval

logical: add the pvalue to the plot?

pval.size

numeric value specifying the p-value text size. Default is 5.

pval.coord

numeric vector, of length 2, specifying the x and y coordinates of the p-value. Default values are NULL

pval.testname

logical: add '(Log-rank)' text to p-value. Default = F

marks

logical: should censoring marks be added?

shape

what shape should the censoring marks be, default is a vertical line

legend

logical. should a legend be added to the plot?

legendposition

numeric. x, y position of the legend if plotted. Default=c(0.85,0.8)

ci

logical. Should confidence intervals be plotted. Default = FALSE

subs

= NULL,

label.nrisk

Numbers at risk label. Default = "Numbers at risk"

size.label.nrisk

Font size of label.nrisk. Default = 10

linecols

Character. Colour brewer pallettes too colour lines. Default ="Set1", "black" for black with dashed line.

dashed

logical. Should a variety of linetypes be used to identify lines. Default = FALSE

cumhaz

Show cumulative incidence function, Default: F

cluster.option

Cluster option for p value, Option: "None", "cluster", "frailty", Default: "None"

cluster.var

Cluster variable

data

select specific data - for reactive input, Default = NULL

cut.landmark

cut-off for landmark analysis, Default = NULL

showpercent

Shows the percentages on the right side.

...

PARAM_DESCRIPTION

Details

DETAILS

Value

Plot

Author(s)

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.

Examples

1
2
3
4
 library(survival)
 data(colon)
 fit <- survfit(Surv(time,status)~rx, data=colon)
 jskm(fit, timeby=500)

Example output



jskm documentation built on Oct. 11, 2021, 9:06 a.m.