Learn R Programming

Epi (version 2.63)

overlap.Lexis: Check if records in a Lexis object represent overlapping epochs

Description

When constructing a Lexis object from a data frame with multiple records there is no guarantee that the records from a given person will represent disjoint time intervals (epochs), overlap checks this.

Usage

# S3 method for Lexis
overlap(Lx, ...)

Value

If no overlapping epochs are found, a message is printed and NULL

is returned. Otherwise a vector of unique ids (from Lx$lex.id) for the persons with overlapping records is returned invisibly

Arguments

Lx

A Lexis object

...

ignored

Author

Bendix Carstensen, http://bendixcarstensen.com, b@bxc.dk

See Also

Lexis

Examples

Run this code
# run the DMlate example to get the Lexis object dmi with
# some persons with multiple (2 that is) records:
example(DMlate)
overlap.Lexis(dmi)
#
# now find 4 persons with multiple records
tt <- table(dmi$lex.id)
has2 <- dmi$lex.id 
table(has2)
#
# add time (0.3 y) to lex.dur for these persons to produce overlapping intervals
dmi$lex.dur[has2] <- dmi$lex.dur[has2] + 0.3
overlap.Lexis(dmi)

Run the code above in your browser using DataLab