Skip to contents

slide generates a data.table with start, center, and end columns for a sliding window analysis.

Usage

slide(from, to, step = 1, before = 0, after = 0)

Arguments

from

integer, the start of the sequence

to

integer, the end of the sequence

step

integer, the step size

before

integer, the number of values before the center of a window

after

integer, the number of values after the center of a window

Value

data.table with start, center, and end columns

Examples

slide(1, 10, step = 2, before = 1, after = 1)
#>    start center   end
#>    <num>  <num> <num>
#> 1:     1      2     3
#> 2:     3      4     5
#> 3:     5      6     7
#> 4:     7      8     9