Description Usage Arguments Details

Efficient windowed / rolling operations. Each function
here applies an operation over a moving window of
size `n`

, with (customizable) weights specified
through `weights`

.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | ```
roll_mean(x, n = 1L, weights = NULL, by = 1L, fill = numeric(0),
partial = FALSE, align = c("center", "left", "right"), normalize = TRUE,
na.rm = FALSE)
roll_meanr(x, n = 1L, weights = NULL, by = 1L, fill = NA,
partial = FALSE, align = "right", normalize = TRUE, na.rm = FALSE)
roll_meanl(x, n = 1L, weights = NULL, by = 1L, fill = NA,
partial = FALSE, align = "left", normalize = TRUE, na.rm = FALSE)
roll_median(x, n = 1L, weights = NULL, by = 1L, fill = numeric(0),
partial = FALSE, align = c("center", "left", "right"), normalize = TRUE,
na.rm = FALSE)
roll_medianr(x, n = 1L, weights = NULL, by = 1L, fill = NA,
partial = FALSE, align = "right", normalize = TRUE, na.rm = FALSE)
roll_medianl(x, n = 1L, weights = NULL, by = 1L, fill = NA,
partial = FALSE, align = "left", normalize = TRUE, na.rm = FALSE)
roll_min(x, n = 1L, weights = NULL, by = 1L, fill = numeric(0),
partial = FALSE, align = c("center", "left", "right"), normalize = TRUE,
na.rm = FALSE)
roll_minr(x, n = 1L, weights = NULL, by = 1L, fill = NA,
partial = FALSE, align = "right", normalize = TRUE, na.rm = FALSE)
roll_minl(x, n = 1L, weights = NULL, by = 1L, fill = NA,
partial = FALSE, align = "left", normalize = TRUE, na.rm = FALSE)
roll_max(x, n = 1L, weights = NULL, by = 1L, fill = numeric(0),
partial = FALSE, align = c("center", "left", "right"), normalize = TRUE,
na.rm = FALSE)
roll_maxr(x, n = 1L, weights = NULL, by = 1L, fill = NA,
partial = FALSE, align = "right", normalize = TRUE, na.rm = FALSE)
roll_maxl(x, n = 1L, weights = NULL, by = 1L, fill = NA,
partial = FALSE, align = "left", normalize = TRUE, na.rm = FALSE)
roll_prod(x, n = 1L, weights = NULL, by = 1L, fill = numeric(0),
partial = FALSE, align = c("center", "left", "right"), normalize = TRUE,
na.rm = FALSE)
roll_prodr(x, n = 1L, weights = NULL, by = 1L, fill = NA,
partial = FALSE, align = "right", normalize = TRUE, na.rm = FALSE)
roll_prodl(x, n = 1L, weights = NULL, by = 1L, fill = NA,
partial = FALSE, align = "left", normalize = TRUE, na.rm = FALSE)
roll_sum(x, n = 1L, weights = NULL, by = 1L, fill = numeric(0),
partial = FALSE, align = c("center", "left", "right"), normalize = TRUE,
na.rm = FALSE)
roll_sumr(x, n = 1L, weights = NULL, by = 1L, fill = NA,
partial = FALSE, align = "right", normalize = TRUE, na.rm = FALSE)
roll_suml(x, n = 1L, weights = NULL, by = 1L, fill = NA,
partial = FALSE, align = "left", normalize = TRUE, na.rm = FALSE)
roll_sd(x, n = 1L, weights = NULL, by = 1L, fill = numeric(0),
partial = FALSE, align = c("center", "left", "right"), normalize = TRUE,
na.rm = FALSE)
roll_sdr(x, n = 1L, weights = NULL, by = 1L, fill = NA,
partial = FALSE, align = "right", normalize = TRUE, na.rm = FALSE)
roll_sdl(x, n = 1L, weights = NULL, by = 1L, fill = NA,
partial = FALSE, align = "left", normalize = TRUE, na.rm = FALSE)
roll_var(x, n = 1L, weights = NULL, by = 1L, fill = numeric(0),
partial = FALSE, align = c("center", "left", "right"), normalize = TRUE,
na.rm = FALSE)
roll_varr(x, n = 1L, weights = NULL, by = 1L, fill = NA,
partial = FALSE, align = "right", normalize = TRUE, na.rm = FALSE)
roll_varl(x, n = 1L, weights = NULL, by = 1L, fill = NA,
partial = FALSE, align = "left", normalize = TRUE, na.rm = FALSE)
``` |

`x` |
A numeric vector or a numeric matrix. |

`n` |
The window size. Ignored when |

`weights` |
A vector of length |

`by` |
Calculate at every |

`fill` |
Either an empty vector (no fill), or a vector (recycled to) length 3 giving left, middle and right fills. |

`partial` |
Partial application? Currently unimplemented. |

`align` |
Align windows on the |

`normalize` |
Normalize window weights, such that they sum to |

`na.rm` |
Remove missing values? |

The functions postfixed with `l`

and `r`

are convenience wrappers that set **l**eft
/ **r**ight alignment of the windowed operations.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.