blk.concomitant: Find Concomitant Events

View source: R/PCSmisc.R

blk.concomitantR Documentation

Find Concomitant Events

Description

Finds “events” (i.e. times) that are “concomitant” with (i.e. occur at the same time as) some given state (or “exposure”) in a block-format data set.

Usage

blk.concomitant(time, id, begin.exposure, end.exposure, id2 = id)

Arguments

time

A vector of times at which to determine the state, in block-format with respect to id.

id,id2

A valid block-format ID.

begin.exposure

A vectors of times delineating when the exposure begins, in block-format with respect to id2.

end.exposure

Vectors of times delineating when the exposure ends, in block-format with respect to id2.

Details

Exposure is determined by start-time/end-time pairs. This function determines whether the exposure is present or absent at specific times in a block-format data set.

Sometimes, the time intervals may overlap. The behaviour in that instance is to count the number of overlapping intevals. For instance,

Inteval 1:      |-----------------|
Inteval 2:             |------------------|
Time:       ^      ^       ^         ^        ^
Value:      0      1       2         1        0

The end times may be missing, indicating open-ended intervals. If all end times are missing, then the same result can be achieved with blk.countPastEvents.

Value

An integer vector in block-format with respect to id. The value indicates how many of the time intervals overlap with the corresponding time.

Author(s)

Benjamin Rich <mail@benjaminrich.net>

See Also

  • block-format

  • blk.countPastEvents


benjaminrich/PCSmisc documentation built on Feb. 11, 2024, 9:25 p.m.