Learn R Programming

reportRx (version 1.0)

plotkm: Plot KM curve

Description

This function will plot a KM curve with possible stratification. You can specifyif you want a legend or confidence bands as well as the units of time used.

Usage

plotkm(data, response, group = 1, pos = "bottomleft", units = "months", CI = F, legend = T, title = "")

Arguments

data
dataframe containing your data
response
character vector with names of columns to use for response
group
string specifiying the column name of stratification variable
pos
what position you want the legend to be. Current option are bottomleft and topright
units
string specifying what the unit of time is use lower case and plural
CI
boolean to specify if you want confidence intervals
legend
boolean to specify if you want a legend
title
title of plot

Examples

Run this code
require(survival)
lung$sex<-factor(lung$sex)
plotkm(lung,c("time","status"))
plotkm(lung,c("time","status"),"sex")

Run the code above in your browser using DataLab