`slide.Rd`

Rolling window with overlapping observations:

`slide()`

always returns a list.`slide_lgl()`

,`slide_int()`

,`slide_dbl()`

,`slide_chr()`

use the same arguments as`slide()`

, but return vectors of the corresponding type.`slide_dfr()`

&`slide_dfc()`

return data frames using row-binding & column-binding.

slide(.x, .f, ..., .size = 1, .step = 1, .fill = NA, .partial = FALSE, .align = "right", .bind = FALSE) slide_dfr(.x, .f, ..., .size = 1, .step = 1, .fill = NA, .partial = FALSE, .align = "right", .bind = FALSE, .id = NULL) slide_dfc(.x, .f, ..., .size = 1, .step = 1, .fill = NA, .partial = FALSE, .align = "right", .bind = FALSE)

.x | An object to slide over. |
---|---|

.f | A function, formula, or vector (not necessarily atomic). If a If a For a single argument function, use `.` For a two argument function, use `.x` and`.y` For more arguments, use `..1` ,`..2` ,`..3` etc
This syntax allows you to create very compact anonymous functions. If |

... | Additional arguments passed on to the mapped function. |

.size | An integer for window size. If positive, moving forward from left to right; if negative, moving backward (from right to left). |

.step | A positive integer for calculating at every specified step instead of every single step. |

.fill | A value to fill at the left/center/right of the data range depending
on |

.partial | if |

.align | Align index at the " |

.bind | If |

.id | Either a string or Only applies to |

if `.fill != NULL`

, it always returns the same length as input.

The `slide()`

function attempts to tackle more general problems using
the purrr-like syntax. For some specialist functions like `mean`

and `sum`

,
you may like to check out for **RcppRoll** for faster performance.

`slide()`

is intended to work with list (and column-wise data frame). To
perform row-wise sliding window on data frame, please check out `pslide()`

.

`.partial = TRUE`

allows for partial sliding. Window contains observations outside of the vector will be treated as value of`.fill`

, which will be passed to`.f`

.`.partial = FALSE`

restricts calculations to be done on complete sliding windows. Window contains observations outside of the vector will return the value`.fill`

.

future_slide for parallel processing

tile for tiling window without overlapping observations

stretch for expanding more observations

Other sliding window functions: `slide2`

#> [1] NA 1.5 2.5 3.5 4.5slide_dbl(x, mean, .size = 2, align = "center")#> [1] NA 1.5 2.5 3.5 4.5#> [1] NA FALSE TRUE TRUE TRUEslide(lst, ~., .size = 2)#> [[1]] #> [1] NA #> #> [[2]] #> [[2]]$x #> [1] 1 2 3 4 5 #> #> [[2]]$y #> [1] 6 7 8 9 10 #> #> #> [[3]] #> [[3]]$y #> [1] 6 7 8 9 10 #> #> [[3]]$z #> [1] 11 12 13 14 15 #> #>