Dataset requirements to make Kaplan-Meier plot with RcmdrPlugin.KMggplot2

Triad sou.

2016-01-04

RcmdrPlugin.KMggplot2 depends survfit function of survival package. Dataset requirements are same as survfit function, which works with Surv objects.

Surv object

Surv objects are generated from Surv function. RcmdrPlugin.KMggplot2 calls as follows:

survfit(Surv(time = x, event = y, type = "right") ~ z + s + t, .df)

Arguments

RcmdrPlugin.KMggplot2 requires a data frame that at least includes time and event variables, and includes z, s, t if you needs

Data Example

time event trt sex marker
17.540935 1 Group-C M Low
16.520777 1 Group-A M Low
6.530335 0 Group-A M High
10.701766 0 Group-B M High
4.779544 1 Group-A M Low
20.000000 0 Group-C M Low
19.527943 1 Group-B M Low
13.065791 1 Group-B M High
8.710817 1 Group-A M High
14.460404 1 Group-B M Low

In this case: