Learn R Programming

biostat3 (version 0.2.1)

lifetab2: Formula wrapper for lifetab from the KMsurv package.

Description

Calculate a life table using the actuarial method using a formula and a data-frame with optional breaks.

Usage

lifetab2(formula, data, subset, breaks = NULL)
# S3 method for lifetab2
plot(x, y=NULL, ...)
# S3 method for lifetab2
lines(x, y=NULL, ...)

Value

A data.frame as per lifetab.

Arguments

formula

formula with the left-hand side being a Surv object, including a time and event indicator, and the right-hand side indicated stratification.

data

optional data.frame for the Surv object. If this is not provided, then the parent frame is used for the Surv object.

subset

optional subset statement

breaks

optional numeric vector of breaks. If this is not provided, then the unique time values from the Surv object are used together with Inf.

x

lifetab2 object

y

unused argument (part of the generic function)

...

other arguments

Author

Mark Clements for the wrapper.

Details

See lifetab for details. This wrapper is meant to make life easier.

A copy of the lifetab function has been included in the biostat3 package to reduce dependencies.

Examples

Run this code
## we can use unique transformed times (colon_sample)
lifetab2(Surv(floor(surv_yy),status=="Dead: cancer")~1, colon_sample)

## we can also use the breaks argument (colon)
lifetab2(Surv(surv_yy,status=="Dead: cancer")~1, colon, breaks=0:10)

Run the code above in your browser using DataLab