tsmatrix(...)
The resulting matrix has a dimnames attribute. If an argument was given a name in the function call, then the corresponding column has that name; if the argument was itself a matrix, then its name is expanded with digits denoting its respective columns. If the argument is a matrix which has a dimnames attribute, then these are used for the corresponding column names.
Multivariate time series are printed by default like a matrix with the tsp attribute printed last. Calling print.ts directly provides an alternative.
Unlike tsmatrix, the function cbind, which also allows vectors or matrices as arguments, makes no effort to make time parameters consistent. Frequently, the two functions can be used together (see the example section).
tsmatrix(x, lag(x), diff(x)) #x, lag-1 of x and first diffs cbind(tsmatrix(x, lag(x)), 1) #two series, column of 1syx <- tsmatrix(EMP = employment, GNP = gnp, LGNP = lag(gnp), ...) yx.df <- data.frame(yx) lm(yx.df) # regression with x and y times aligned