hsEvents: Timestamp differences to events

View source: R/eventMain.R

hsEventsR Documentation

Timestamp differences to events

Description

Creates events from vector tseries of timestamps based on time differences between consecutive timestamps in tseries.

Usage

hsEvents(
  tseries,
  evtSepTime,
  signalWidth,
  tUnit = "s",
  pause = TRUE,
  evtSepOp = "gt",
  dbg = FALSE,
  check.sorting = FALSE
)

Arguments

tseries

vector containing a sorted list of timestamps.

evtSepTime

“event separation time” in seconds. Maximal allowed time difference between two consecutive timestamps within the same event.

signalWidth

“signal width” in seconds. Length of time interval that one timestamp is representing, e.g. 5*60 = 300 if each timestamp respresents a time interval of five minutes (as e.g. a time series is recorded on a five minute time scale). This parameter is needed to calculate event durations.

tUnit

time unit of event duration and event pauses

pause

if TRUE, pauses before and after the events are calculated

evtSepOp

event separation operator, either "gt" or "ge". If evtSepOp = "gt" (default) events are separated on time differences between two consecutive timestamps that are greater than evtSepTime. If evtSepOp = "ge" events are separated on time differences between two consecutive timestamps that are greater than or equal to evtSepTime.

dbg

if TRUE, debug messages are shown.

check.sorting

if TRUE, it is checked whether the timestamps given in tseries are sorted and the program stops if this is not the case.

Value

data frame with columns iBeg and iEnd indicating first and last index of the event in the tseries vector, tBeg and tEnd indicating first and last timestamp of the event and dur indicating the event duration in seconds.

See Also

eventsOnChange


KWB-R/kwb.event documentation built on June 14, 2022, 1:15 p.m.