ts_windower: Get sliding window indices

ts_windowerR Documentation

Get sliding window indices

Description

Get sliding window indices

Usage

ts_windower(
  y,
  win = length(y),
  step = NA,
  overlap = NA,
  adjustY = NA,
  alignment = c("r", "c", "l")[1],
  silent = TRUE
)

Arguments

y

A time series or numeric vector

win

Size of the window to slide across y

step

Size of steps between windows. Can be larger than win, but is ignored if overlap is not NA.

overlap

A value between ⁠[0 .. 1]⁠. If overlap is not NA (default), the value of step is ignored and set to floor(overlap*win). This produces indices in which the size of step is always smaller than win, e.g. for fluctuation analyses that use binning procedures to represent time scales.

adjustY

If not NA, or, FALSE a list object with fields that match one or more arguments of ts_trimfill (except for ⁠x,y⁠), e.g. list(action="trim.NA",type="end",padding=NA,silent=TRUE). See ⁠Return value⁠ below for details.

alignment

Whether to right ("r"), center ("c"), or left ("l") align the window.

silent

Silent mode.

Value

If adjustY is a list object with fields that represent arguments of ts_trimfill, then the (adjusted) vector y is returned with an attribute "windower". This is a list object with fields that contain the indices for each window that fits on y, given win, step or overlap and the settings of adjustY. If adjustY = NA, only the list object is returned. An attribute time is returned with the time index based on the alignment arguments.

See Also

Other Time series operations: ts_center(), ts_changeindex(), ts_checkfix(), ts_detrend(), ts_diff(), ts_discrete(), ts_duration(), ts_embed(), ts_integrate(), ts_levels(), ts_peaks(), ts_permtest_block(), ts_permtest_transmat(), ts_rasterize(), ts_sd(), ts_slice(), ts_slopes(), ts_standardise(), ts_sumorder(), ts_symbolic(), ts_trimfill()

Other Tools for windowed analyses: plotMRN_win()


FredHasselman/casnet documentation built on April 20, 2024, 3:05 p.m.