mean_streak: Mean time span of increasing/decreasing streaks

View source: R/Analyses_functions_2.R

mean_streakR Documentation

Mean time span of increasing/decreasing streaks

Description

Computes the mean time span of the increasing/decreasing streaks for the provided time interval or its sub-interval.

Usage

mean_streak(X, direction = "increasing", subI = NULL, plot = FALSE)

Arguments

X

Data frame where the first column is a numeric time sequence t and the second one is the values of the time series X(t).

direction

A character string which specifies the direction of the streak: "increasing" or "decreasing".

subI

Time sub-interval is a vector, where the lower bound is the first element and the upper bound is the second. Optional: If provided mean time span of the sub-interval is returned, otherwise the whole time interval is considered.

plot

Logical: If TRUE, the time series and the increasing/decreasing streaks are plotted in interactive sessions.

Value

Mean time span of the increasing/decreasing streaks.

See Also

long_streak

Examples

t <- seq(0, 1 ,length = 100)
TS <- data.frame("t" = t,"X(t)" = rnorm(100))
mean_streak(TS, direction = 'decreasing', subI = c(0.2,0.8), plot = TRUE)


Rmfrac documentation built on Sept. 10, 2025, 10:31 a.m.