TSMERGE {bimets} | R Documentation |
Merge Time Series
Description
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 input time series list 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 input time series' date spans 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 can also be computed as a function of the values of the input time series in the same period (see example).
Usage
TSMERGE(..., fun = NULL, MV = FALSE, avoidCompliance = FALSE)
Arguments
... |
Input list of time series that must satisfy the compliance control check defined in |
fun |
By defining the argument |
MV |
If |
avoidCompliance |
If |
Value
This function returns a BIMETS time series built by merging two or more input time series.
See Also
TSJOIN
TSEXTEND
TSLAG
TSPROJECT
TSLEAD
TSTRIM
Examples
#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))