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

View source: R/overlap.Lexis.R

overlap.LexisR Documentation

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 class 'Lexis'
overlap(Lx, ...)

Arguments

Lx

A Lexis object

...

ignored

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

Author(s)

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

See Also

Lexis

Examples

# 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 %in% names(tt[tt > 1])[1:4]
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))

Epi documentation built on April 15, 2026, 9:09 a.m.

Related to overlap.Lexis in Epi...