rollvec: Rolling Summaries of a Vector

View source: R/signal.R

rollvecR Documentation

Rolling Summaries of a Vector

Description

Summarize a vector in rolling windows.

Usage

rollvec(x, width, stat = "sum", prob = 0.5)

Arguments

x

A numeric vector.

width

The width of the rolling window. Must be odd.

stat

The statistic used to summarize the values in each bin. Must be one of "sum", "mean", "max", "min", "sd", "var", "mad", or "quantile".

prob

The quantile for stat = "quantile".

Value

An numeric vector with the same length as x with the summarized values from each rolling window.

Author(s)

Kylie A. Bemis

Examples

set.seed(1)

x <- sort(runif(20))

rollvec(x, 5L, "mean")

kuwisdelu/matter documentation built on Dec. 8, 2024, 8:09 p.m.