View source: R/bimets_ts_functions.R
CUMSUM | R Documentation |
This function returns the cumulative sum of the elements of the input array or time series. The result is an object of the same class of the input, and its elements are the cumulative sum of the current and the previous elements of the input.
If the input is a time series, users can provide the argument TSRANGE
in order to project the input time series before the cumulative sum.
CUMULO
is an alias form CUMSUM
with the argument MODE='YEARLY'
.
CUMSUM(x=NULL, TSRANGE=NULL, MODE=NULL, ignoreNA=FALSE, avoidCompliance=FALSE,...)
CUMULO(x=NULL, TSRANGE=NULL, ignoreNA=FALSE, avoidCompliance=FALSE,...)
x |
Input numerical array or time series that must satisfy the compliance control check defined in |
TSRANGE |
Optional date range of operations that process time series. |
MODE |
When selecting |
ignoreNA |
Ignore missing values. |
avoidCompliance |
If |
... |
Backward compatibility. |
This function returns an object of the same class of the input, i.e. an array or a BIMETS time series.
TSPROJECT
MOVAVG
TSDELTA
TSLAG
TSPROJECT
TSEXTEND
TSLEAD
INDEXNUM
CUMPROD
VERIFY_MAGNITUDE
GETRANGE
#create ts
ts1<-TSERIES(INTS(1,30),START=c(2000,1),FREQ='M')
out_CUMSUM<-CUMSUM(ts1)
TABIT(out_CUMSUM)
out_CUMSUM<-CUMSUM(ts1,TSRANGE=c(2000,4,2001,7))
out_CUMSUM_Y<-CUMSUM(ts1,TSRANGE=c(2000,4,2001,7),MODE='YEARLY')
TABIT(ts1,out_CUMSUM,out_CUMSUM_Y)
#define an array
arr1<-c(INTS(1,10),INTS(-1,-10))
out_CUMSUM<-CUMSUM(arr1)
print(out_CUMSUM)
#print...1 3 6 10 15 21 ... 27 19 10 0
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.