TSMERGE {bimets} | R Documentation |
This function merges and concatenates two or more time series of the same frequency. The output time series will be defined over the union of dates for which the input time series are defined, from the earliest starting date to the latest ending date.
For each period the output value will be set equal to the first non-missing value found in the list of the input time series, by using the order of the arguments. If
all the input time series are missing at a period, then the output time series will be set to the missing value NA
in the same period. Note that if the date spans of the input time series do not intersect, TSMERGE(X1,X2,...,XN)
returns a simple concatenation of X1, X2,..., XN
.
By defining the argument fun
, the value of the output time series in a period can also be computed as a function of the values of the input time series in the same period.
TSMERGE(..., fun = NULL, MV = FALSE, avoidCompliance = FALSE)
... |
Input list of time series that must satisfy the compliance control check defined in |
fun |
By defining the argument |
MV |
If |
avoidCompliance |
If |
This function returns a BIMETS time series built by merging two or more input time series.
TSJOIN
TSEXTEND
TSLAG
TSPROJECT
TSLEAD
TSTRIM
#DEFINE TS n=10 ts1=TSERIES(n:1,START=c(1995,1),FREQ=1) ts2=TSERIES(n:1,START=c(2000,1),FREQ=1) ts2[5]=NA ts1[10]=NA #print TSMERGE TABIT(ts1,ts2,TSMERGE(ts1,ts2,fun='SUM',MV=TRUE)) #TS D n=20 ts1=TSERIES(n:1,START=c(1999,360),FREQ='D') ts2=TSERIES(n:1,START=c(2000,1),FREQ='D') ts2[5]=NA ts1[10]=NA #print TSMERGE TABIT(ts1,ts2,TSMERGE(ts1,ts2,fun='SUM',MV=TRUE))