eventProcessing: Event Processing

Description Usage Arguments Value Examples

Description

Computes the event number eventNum, the length of events eventLen, or the sequence number for individual observations within an event eventSeq. Added from smwrBase.

Usage

1
2
3
4
5
eventNum(event, reset = FALSE, na.fix = FALSE)

eventSeq(eventno)

eventLen(eventno, summary = FALSE)

Arguments

event

a logical vector where TRUE indicates that an event occurred. Missing values are treated as instructed by na.fix.

reset

a logical value indicating whether the event is assumed to continue until the next event, or only while event is TRUE.

na.fix

the value to use where event has missing values (NAs).

eventno

an integer vector indicating the event number. Generally the output from the eventNum function.

summary

a logical value, controlling output. See Value for details.

Value

The function eventNum returns an integer vector the same length as event indicating the event sequence number.

The function eventLen returns an integer vector the same length as eventno indicating the sequence length of the event if summary is FALSE, or a named integer vector indicating the sequence length of each event if summary is TRUE.

The function eventSeq returns an integer vector the same length as eventno indicating the sequence number of each element in the event.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Notice the difference caused by setting reset to TRUE
eventNum(c(TRUE,TRUE,FALSE,FALSE,TRUE,FALSE))
eventNum(c(TRUE,TRUE,FALSE,FALSE,TRUE,FALSE), reset=TRUE)

## Notice the difference caused by setting reset to TRUE
eventSeq(eventNum(c(TRUE,TRUE,FALSE,FALSE,TRUE,FALSE)))
eventSeq(eventNum(c(TRUE,TRUE,FALSE,FALSE,TRUE,FALSE), reset=TRUE))

## Notice the difference caused by setting reset to TRUE
eventLen(eventNum(c(TRUE,TRUE,FALSE,FALSE,TRUE,FALSE), reset=TRUE))
## This is an example of the summary option
eventLen(eventNum(c(TRUE,TRUE,FALSE,FALSE,TRUE,FALSE), reset=TRUE), summary=TRUE)

baytrends documentation built on July 19, 2018, 5:01 p.m.