TSJOIN {bimets}R Documentation

Join Time Series

Description

This function returns the join of the two input time series. If the first time series overlaps the second time series, output data is taken from the first time series up to the starting date of the second time series, the remainder of the data being taken from the second time series.
A different joining period can be specified by using the JPRD argument.
The two time series must have the same frequency.

Usage

TSJOIN(x = NULL, y = NULL, JPRD = NULL, ALLOWGAP = FALSE, 
       WARN = FALSE, avoidCompliance = FALSE, ...)

Arguments

x

First input time series that must satisfy the compliance control check defined in is.bimets.

y

Second input time series that must satisfy the compliance control check defined in is.bimets.

JPRD

This arguments is for defining a joining period other than the starting period of the second time series, that is the default joining period. It must be defined as JPRD=c(YEAR,PERIOD) and must lie in the time range of the second time series. Users can convert a Date(), or a yearmon() or a yearqtr() to a c(YEAR,PERIOD) by using date2yp, ym2yp, yq2yp.

ALLOWGAP

if TRUE, the possible gap between the two time series is filled with missing values NA, otherwise if the two time ranges do not overlap an error will be thrown.

WARN

Print a warning message if the two time series do not overlap or if the first time series starts after the JPRD. The warning is shown only if ALLOWGAP=TRUE.

avoidCompliance

If TRUE, compliance control check of input time series will be skipped. See is.bimets

...

Backward compatibility.

Value

This function returns a BIMETS time series that is built by joining the two input time series.

See Also

TSLAG
TSEXTEND
TSMERGE
TSPROJECT

Examples

	
  #day and month names can change depending on locale
  Sys.setlocale('LC_ALL','C')
  Sys.setlocale('LC_TIME','C')
  
  #TS
  ts1=TSERIES((1:10),START=c(1985,1),FREQ=1)
  ts2=TSERIES((1:10),START=c(2000,1),FREQ=1)
  TABIT(ts1,ts2,TSJOIN(ts1,ts2,ALLOWGAP=TRUE))
  
  #XTS
  setBIMETSconf('BIMETS_CONF_CCT','XTS')
  n=10
  xArr=(0:n)
  dateArr=as.yearqtr('1997 Q1')+ 0:n/4
  dataF=data.frame(dateArr,xArr)
  ts1=xts(dataF[,2],order.by=dataF[,1])
  dateArr=as.yearqtr('2000 Q1')+ 0:n/4
  dataF=data.frame(dateArr,xArr)
  ts2=xts(dataF[,2],order.by=dataF[,1])
  TABIT(ts1,ts2,TSJOIN(ts1,ts2,ALLOWGAP=TRUE,JPRD=yq2yp(as.yearqtr("2001 Q3"))))
  
  #restore default
  setBIMETSconf('BIMETS_CONF_CCT','TS')
	

[Package bimets version 1.5.3 Index]