movingDiff | R Documentation |
Filter a regular series of data to compute a moving difference.
movingDiff(x, span = 1, pos = "end")
x |
the data to be averaged or differenced. Missing values are permitted but result in missing values in the output. |
span |
the span of the differences. |
pos |
how to position the output data relative to the value returned;
"center" means that value represents the difference between the
preceding |
A vector of the same length as x
containing the differences.
filter
, diff
, movingAve
# Construct a simple valley movingData <- abs(seq(-5, 5)) movingDiff(movingData, span=1) # Compare to diff: diff(movingData)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.