Description Usage Arguments Details Value Functions Examples
This function returns A matrix: the first column is the position, the second column the input vector, and third column Moving Count of the given vector. The weight argument is optional.
1 2 3 4 | movCountUE(vec, pos, n = 1L, ss = 1L, na_rm = FALSE, sizeD = FALSE,
align = "left")
movCountUEr(vec, pos, n = 1L, ss = 1L, na_rm = FALSE, sizeD = FALSE)
|
vec |
A numeric vector. |
pos |
A numeric vector with all integers. Its length must be the SAME as vec. N.B. We use integers to represent the (relative) positions of every point. |
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" |
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.
This function is more helpful than movCount
, as we would have missing values for an Unevenly
Spaced Time Series.
For matrix details, please refer to details of movMeanUE
.
This function returns A MATRIX of size: L*3, where L is the length of vector, or
of size: L1*3, where L1 = ceiling
((nrow - n + 1)/ss),
(when sizeD = T). In the matrix, the first column denotes the position, the second column the
original vector, and the third column the moving average.
movCountUEr
: An function equivalent to movCountUE(..., align = "right")
1 2 3 4 5 6 7 8 9 10 11 12 | movCountUEr(c(1, 4, 3, NA, 8), pos = c(1, 2, 7, 8, 9), 2)
movCountUEr(c(1, 4, 3, NA, 8), pos = c(1, 2, 7, 8, 9), n = 2, na_rm = TRUE)
movCountUEr(c(1, 4, 3, NA, 8), pos = c(1, 2, 7, 8, 9), n = 2, ss = 3, na_rm = TRUE,
sizeD = TRUE)
movCountUE(c(1, 4, 3, NA, 8), pos = c(1, 2, 7, 8, 9), n = 2,
ss = 3, na_rm = TRUE, align = "right")
movCountUE(c(1, 4, 3, NA, 8), pos = c(1, 2, 7, 8, 9), n = 2, ss = 3,
na_rm = TRUE, sizeD = TRUE, align = "right")
movCountUEr(c(1, 4, 3, NA, 8), pos = c(1, 2, 7, 8, 9), n = 2, ss = 3,
na_rm = TRUE)
movCountUEr(c(1, 4, 3, NA, 8), pos = c(1, 2, 7, 8, 9), n = 2, ss = 3, na_rm = TRUE,
sizeD = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.