Learn R Programming

survMisc (version 0.2)

tneSurvByGroup: Time, No. at risk, No. events by group

Description

Gives time, no. at risk and no. events for survival data by group

Usage

tneSurvByGroup(t, e, p, np, onlyEvents = FALSE)

Arguments

t
Times
e
No. events (overall)
p
Predictor
np
No. events for this predictor
onlyEvents
if TRUE shows only times at which at least one event occurred. Otherwise shows all times recorded (including those censored).

Value

  • A list with one element corresponding to each value of the predictor $p$. Each element is a matrix, with one row for each observation. The columns in the matrix are:
  • ttime
  • nno. at risk
  • eno. events

References

Example is from: Klein J, Moeschberger M 2003 Survival Analysis, 2nd edition. New York: Springer. Example 7.2, pg 210.

Examples

Run this code
data(kidney,package="KMsurv")
s <- survfit(Surv(time=time, event=delta) ~ type, data=kidney )
df2 <- tneSurvfit(s)
tneSurvByGroup(t=df2$t,e=df2$e,p=df2$p,np=df2$np)

Run the code above in your browser using DataLab