Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

join.spells

Straighten up a survival data frame


Description

Unnecessary cut spells are glued together, overlapping spells are "polished", etc.

Usage

join.spells(dat, strict = FALSE, eps = 1e-08)

Arguments

dat

A data frame with names enter, exit, event, id.

strict

If TRUE, nothing is changed if errors in spells (non-positive length, overlapping intervals, etc.) are detected. Otherwise (the default), bad spells are removed, with "earlier life" having higher priority.

eps

Tolerance for equality of two event times. Should be kept small.

Details

In case of overlapping intervals (i.e., a data error), the appropriate id's are returned if strict is TRUE.

Value

A data frame with the same variables as the input, but individual spells are joined, if possible (identical covariate values, and adjacent time intervals).

Author(s)

Göran Broström

References

Therneau, T.M. and Grambsch, P.M. (2000). Modeling Survival Data: Extending the Cox model. Springer.

See Also


eha

Event History Analysis

v2.10.0
GPL (>= 2)
Authors
Göran Broström [aut, cre], Jianming Jin [ctb]
Initial release
2022-04-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.