lifetable: Implementation of the actuarial life table method.

Description Usage Arguments Value See Also Examples

View source: R/life-table.R

Description

Given a data set in standard format with one row per observation unit, transform the data set into interval data, where intervals are specified via breaks. Each observation unit will have as many rows as interval start points that it survived.

Usage

1
2
3
4
5
6
7
8
lifetable(
  data,
  breaks = NULL,
  time_var = "time",
  status_var = "status",
  right_closed = FALSE,
  max_end = FALSE
)

Arguments

data

Data set from which time and status variables will be extracted.

breaks

The time points of the interval borders.

time_var

The variable storing event times.

status_var

The variable storing the event indicator.

right_closed

Logical. If TRUE (default), intervals are assumed right_closed closed and left open. If FALSE left closed and right_closed open.

max_end

logical. Should the last interval span until the last observed censoring or event time (if larger than the largest specified cut point).

Value

A tibble containing riskset information as well as hazard and survival function calculated by using the actuarial life table method.

See Also

split_info

Examples

1
2
3
data("Melanoma", package="MASS")
Melanoma$status <- ifelse(Melanoma$status == 1, 1, 0)
lifetable(Melanoma, breaks = seq(0, 6000, 1500))

adibender/ldatools documentation built on March 7, 2020, 5:30 a.m.