Merging (multivariate) time series

The following makes use of the zoo package. You may need to install it from CRAN using the code install.packages("zoo") if you want to run this on your computer. (The package is already installed on the notebook container, however.)

library(zoo)
Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric

The file “zpresidents.RData” was created in an earlier example.

load("unemployment-z.RData")
Netherlands <- unemployment.z[,4]
length(Netherlands)
[1] 30
Belgium <- unemployment.z[,5]
length(Belgium)
[1] 30
Luxembourg <- na.omit(unemployment.z[,6])
length(Luxembourg)
[1] 26
unemployment.benelux <- merge(Netherlands,
                              Belgium,
                              Luxembourg)
head(unemployment.benelux,n=10)
           Netherlands Belgium Luxembourg
1970-12-31       0.868   1.913         NA
1971-12-31       1.213   1.848         NA
1972-12-31       2.114   2.350         NA
1973-12-31       2.151   2.408         NA
1974-12-31       2.624   2.523      0.067
1975-12-31       3.772   4.522      0.200
1976-12-31       4.067   5.934      0.332
1977-12-31       3.916   6.745      0.531
1978-12-31       3.827   7.321      0.797
1979-12-31       3.648   7.581      0.725