splice: Splice Time Series

Description Usage Arguments Details Value See Also Examples

View source: R/tframe.R

Description

Splice together (in time dimension) two time series objects. This function can also be used to overlay obj1 on obj2 (obj1 takes precedence). The time windows do not have to correspond.

Usage

1
2
3
4
    splice(mat1,mat2, ...)
    ## Default S3 method:
splice(mat1,mat2, ...)
    

Arguments

mat1

A time series object.

mat2

A time series object.

...

arguments to be passed to other methods (not used by the default method).

Details

Splice together two time series objects. The mat1 and mat2 objects should contain the same number of time series variables and be arranged in the same order. (e.g. - the first column of mat1 is spliced to the first column of mat2, etc.). If data is provided in both mat1 and mat2 for a given period then mat1 takes priority. The frequencies should be the same.

Value

A time series object

See Also

tfwindow, trimNA, tbind

Examples

1
2
splice(ts(matrix(rnorm(24),24,1), start=c(1980,1), frequency=4),
       ts(matrix(rnorm(6),  6,1), start=c(1986,1), frequency=4))

Example output

           Qtr1       Qtr2       Qtr3       Qtr4
1980 -1.2643601  1.9741193  1.1078444  0.1514543
1981  2.0664299 -2.2829308 -0.9770635 -0.5064582
1982  2.2444835 -0.3289112 -1.2716320 -0.1491040
1983 -0.7017313  0.8327177 -1.0662066 -0.3507490
1984  0.4518151  0.8831814  0.9424995 -1.7796708
1985  0.3574752  0.2600462 -0.2451391 -0.1597856
1986 -0.9919213 -2.1175418 -0.2636870 -0.5836722
1987 -0.1251477 -0.6274984                      

tframe documentation built on Sept. 23, 2019, 3:01 a.m.

Related to splice in tframe...