blk.findConsecutive: Finds Consecutive Rows With a Common Property

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Groups of consecutive rows are identified, where each row in the group has a certain property.

Usage

1
blk.findConsecutive(id, ind, min.consec = 2)

Arguments

id

A valid block-format ID.

ind

A logical vector in block-format with respect to id that designates rows in the data set for which the property holds.

min.consec

An integer specifying the minumum size of a group.

Details

This function operates on data sets in block-format. Some rows have a certain property as indicated by ind. This function identifies groups of rows that all possess the property, are consecutive and have a minimum size min.consec. All such groups of rows identified are assigned a unique integer ID. All remaining rows are given the value 0.

Value

An integer vector in block-format with respect to id containing a unique group ID for rows belonging to identified groups, and 0 otherwise.

Author(s)

Ben Rich <benjamin.rich@certara.com>

See Also

block-format

Examples

1
2
3
4
5
6
7
8
require(nlme)
data(Phenobarb)
dat <- Phenobarb[1:56,]  # First 4 subjects
attach(dat)

cbind(dat, CONSEC=blk.findConsecutive(asID(Subject), ind=!is.na(dose), min.consec=5))

detach(dat)

benjaminrich/PCSmisc documentation built on May 24, 2019, 5:02 a.m.