Coerce Coredata of Univariate Zoo Time Series to Matrix
Coerce Coredata of Univariate Zoo Time Series to Matrix
Transforms vector coredata of univariate zoo time series to class matrix. If the input zoo time series has the attribute "name", the output inherits the value of such attribute.
Multivariate zoo objects are returned without changes.
zoo_vector_to_matrix(x =NULL, name =NULL)
Arguments
x: (required, zoo object) zoo time series. Default: NULL
name: (required, character string) name of the matrix column. Default: NULL
Returns
zoo time series
Examples
#create zoo object from vectorx <- zoo::zoo( x = runif(100))#coredata is not a matrixis.matrix(zoo::coredata(x))#convert to matrixy <- zoo_vector_to_matrix( x = x
)#coredata is now a matrixis.matrix(zoo::coredata(y))