blk.countPastEvents: Count Past Events

View source: R/PCSmisc.R

blk.countPastEventsR Documentation

Count Past Events

Description

Counts how many events occurred before the specified times in a block-format data set.

Usage

blk.countPastEvents(time, id, event.t = time, id2 = id)

Arguments

time

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

id,id2

A valid block-format ID.

event.t

A vector of times at which events occur, in block-format with respect to id2.

Details

This function operates on data sets in block-format. The times at which “events” occur is specified. For a given vecotr of times, this function counts how many events occurred prior to each of those times.

For instance, one may wish to compute how many episodes of a given disease occurred prior to baseline time (t=0) for each individual.

Value

An integer vector in block-format with respect to id. The value indicates how events occurred prior to the corresponding time.

Author(s)

Benjamin Rich <mail@benjaminrich.net>

See Also

  • block-format

  • blk.concomitant

Examples

require(nlme)
data(Phenobarb)
dat <- Phenobarb[1:56,]  # First 4 subjects
attach(dat)

cbind(dat, LAST.DOSE=blk.locf(dose, asID(Subject)))

detach(dat)

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