MOVTOT {bimets} | R Documentation |
Moving Sum
Description
This function returns the moving sum of the elements of the input array or the input time series. The result is an object of the same class of the input, and its elements are the moving sum of length L
of the input values. If the input is a time series, the DIRECTION
of the moving sum, i.e backward, forward or centered, can be provided. MTOT
and MSUM
are alias for MOVTOT
and MOVSUM
Usage
MOVSUM(x = NULL, L = NULL, DIRECTION = NULL, ignoreNA=FALSE, avoidCompliance = FALSE, ...)
MOVTOT(x = NULL, L = NULL, DIRECTION = NULL, ignoreNA=FALSE, avoidCompliance = FALSE, ...)
Arguments
x |
Input numerical array or time series that must satisfy the compliance control check defined in |
L |
Length of the sum. It must be a positive integer. |
DIRECTION |
if |
ignoreNA |
Ignore missing values. |
avoidCompliance |
If |
... |
Backward compatibility. |
Value
This function returns an object of the same class of the input, i.e. an array or a BIMETS time series.
See Also
TSDELTA
TSLAG
TSPROJECT
TSEXTEND
TSLEAD
CUMSUM
INDEXNUM
VERIFY_MAGNITUDE
GETRANGE
Examples
#input data
inputArray<-c(1,2,3,4,NA,1,2,3,4,5)
#array lag 3
out_movtot<-MOVSUM(inputArray,3)
print(out_movtot)
#ts lag 4 centered with missings
ts1<-TSERIES(inputArray,START=c(2000,1),FREQ='A')
out_movtot<-MOVSUM(ts1,4,'CENTER')
TABIT(out_movtot)
#ts daily
ts1<-TSERIES(inputArray,START=c(2000,1),FREQ='D')
out_movtot<-MSUM(ts1,3)
TABIT(ts1,out_movtot)