plotKM | R Documentation |
Creates Kaplan-Meier survival curves, prints a number at risk table and calculates & plots a Cox-PH LRT p-value. Median event times are indicted by addiditional lines.
plotKM(
srv,
grp,
xlim = NULL,
col = NULL,
xyleg = NULL,
offsetNRisk = -0.2,
yDelta = 0.1,
nRiskCat = 4,
pval = NULL,
mar = NULL,
subject = NULL,
dist = NULL,
MDPI = F,
...
)
srv |
Survival obejct as obtained by survival::Surv() |
grp |
grouping variable |
xlim |
xlim range to plot. Default: 0-max time included in the srv object |
xyleg |
vector contaning x,y coordinates to the legend |
offsetNRisk |
offset in y dimensions to move the number at risk table |
yDelta |
y difference between rows of the number at risk table |
nRiskCat |
Number of breaks of the number a risk table |
pval |
xy coordinates of where to plot the pvalue |
mar |
margin parameter, calculated internally (default). Not used if mar is set to anything different from NULL |
MDPI |
if set to T, adhere to MDPI requirements |
require(survival)
time <- c(10,7,8,4,11,14)
status <- c(1,1,1,0,1,0)
srv <- Surv(time, status)
grp <- c(rep("A", 3), rep("B", 3))
plotKM(srv, grp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.