Identifies events as periods where of consecutively TRUE values in a boolean vector.

get_consecutive(
  vec,
  merge_threshold = NA,
  leng_threshold = 3,
  do_merge = FALSE
)

Arguments

vec

A vector of boolean values. Consecutive TRUE vakues designate an event.

merge_threshold

An integer value specifying the threshold of the gap length below in units of time steps which gaps between events are ignored and the two events on either side of the gap are merged into a single events. Defaults to NA (ignored). Is ignored if do_merge=FALSE

leng_threshold

An integer specifying the minimum length required for creating an event. Defaults to 3.

do_merge

A logical specifying whether to merge events if the gap between them is small (smaller than merge_threshold).

Value

A data frame containing information about the start date and length of each detected event