roll_sd {seismicRoll}R Documentation

Rolling Standard Deviation with Alignment

Description

Fast rolling standard deviations with aligment using C++/Rcpp. Additional performance gains can be achieved by skipping increment values between calculations.

Usage

roll_sd(x, n = 7, increment = 1, align = "center")

Arguments

x

an R numeric vector

n

integer window size

increment

integer shift to use when sliding the window to the next location

align

window alignment, one of "left"|"center"|"right"

Details

The window size n is interpreted as the full window length.

Setting increment to a value greater than one will result in NAs for all skipped-over indices.

The align parameter determines the alignment of the current index within the window. Thus:

Value

A vector of rolling standard deviation values of the same length as x.

Note

For align="center", the window size is increased by one if necessary to guarantee an odd window size.


[Package seismicRoll version 1.1.5 Index]