# movCount: Moving Count In RcppMovStat: Fast Moving Statistics Calculation

## Description

This function returns a moving count of the given vector.

## Usage

 ```1 2 3 4``` ```movCount(vec, n = 1L, ss = 1L, na_rm = FALSE, sizeD = FALSE, align = "left") movCountr(vec, n = 1L, ss = 1L, na_rm = FALSE, sizeD = FALSE) ```

## Arguments

 `vec` A numeric vector. `n` An integer: moving window size, with 1 as default `ss` An integer: step size, only calculating at points with an equal distance ss. Namely, there are ss-1 number between each two 'consecutive' points `na_rm` logical. Should missing values (including NaN) be removed? `sizeD` logical. Only applied when ss > 1, it decides whether to get a result of smaller size. If sizeD = T, align does not affect the output. `align` A string denotes how to align the moving average, three options: "left", "middle", "right"

## Details

This function counts the number of non-missing values for each moving window. It is especially designed for vec vector with missing values. Otherwise, it will return a trivial vector with all elements n.

## Value

This function returns a vector whose length is the same as that of vec or is `ceiling`((L - n + 1)/ss), (when sizeD = T), where L is the length of vec.

## Functions

• `movCountr`: An function equivalent to `movCount(..., align = "right")`

## Examples

 ```1 2 3 4``` ```movCount(c(1, 4, 3, NA, 8), 2, na_rm = TRUE) movCount(c(1, 4, 3, NA, 8), 2, na_rm = TRUE, align = 'right') movCountr(c(1, 4, 3, NA, 8), 2, na_rm = TRUE) movCount(c(1, 4, 3, NA, NA), 2, na_rm = TRUE) ```

RcppMovStat documentation built on Jan. 30, 2018, 5:04 p.m.