Get sliding window indices
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 ifoverlapis not NA.- overlap
A value between
[0 .. 1]. If overlap is notNA(default), the value ofstepis ignored and set tofloor(overlap*win). This produces indices in which the size ofstepis always smaller thanwin, e.g. for fluctuation analyses that use binning procedures to represent time scales.- adjustY
If not
NA, or,FALSEa list object with fields that match one or more arguments of ts_trimfill (except forx,y), e.g.list(action="trim.NA",type="end",padding=NA,silent=TRUE). SeeReturn valuebelow 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()
