EventDurationAndTimeDifference: Calculate Duration of Events and Time Difference between...

View source: R/EventDurationAndTimeDifference.R

EventDurationAndTimeDifferenceR Documentation

Calculate Duration of Events and Time Difference between Events

Description

High level function that calculates time difference between events (if more than one) and duration of events, as well as the Counts of events.

Usage

EventDurationAndTimeDifference(Time,EventNameorValue,EventArrayOrEvent,

units='mins',PeriodBetweenEvents=0,formating="(%y-%m-%d %H:%M:%S)"

,Timezone='UTC',Silent=FALSE)

Arguments

Time

[1:n] Time, a chron object or a POSIXlt object or a character vector, Devicespezifische Zeit, if not chron object, please adjust format neceassry It hast to be convertible to character

EventNameorValue

character or value to search for

EventArrayOrEvent

[1:n,1:d] Array (character or numericalö matrix with d>1) or vector (d=1) of string or Values where the event has to be searched in, list cannot be interpreted, dataframes are converted to matrices. It is assumed that the time row defines the time of the corresponding row of EventArrayOrEvent

formating

default="(%y-%m-%d %H:%M:%S)", else check strptime function

units

character string of units of time for output: "secs", "mins", "hours", "days"

PeriodBetweenEvents

numerical value in time units specified in units, time betweed two events which is assumed that it interrupts one event into several events (e.g. due to data quality) but is in reality only one event. default =0, in that case the approximation of events by filtering is turned of

Timezone

sometimes durations and time difference cannot be calculated if timezone is not chosen, default: 'UTC'

Silent

default (FALSE), if TRUE, error warnings regarding events disabled

Details

sometimes there issues in the quality of data, than its usefull to define a period of time between two events, where one assumes that both events reprent only one event, in that case chose for PeriodBetweenEvents a value above zero

Value

list with following values

Time

[1:n] Time as posixCCT

Counts

value k of events found, zero if no event found

Duration

[1:k] Duration of k Events found, NA if no event found and NaN if Event does not end or not computable (EventArrayOrEvent[n,d]=EventNameorValue)

Difference

[1:k-1] Diference of Time between k events found, NA if only one event found and NaN if not computable

BeginIndsFound

[1:k] Beginning-Indizes for Beginning of k Events found (not column depended), NULL if no event found

EndOfEventsInds

[1:k] Ending- Indizes for Beginning of k Events found (not column depended), NULL if no event found, NaN if Event has no end in the given Time

Note

for details on formating and Timezone check the strptime function.

Author(s)

Michael Thrun


Mthrun/TSAT documentation built on Feb. 5, 2024, 11:15 p.m.