as.data.frame.uts_matrix: Coerce to a Data Frame

Description Usage Arguments Note See Also Examples

View source: R/uts_matrix.R

Description

Flatten a uts_matrix to a data.frame.

Usage

1
2
## S3 method for class 'uts_matrix'
as.data.frame(x, ..., method = "wide")

Arguments

x

a "uts_matrix" object.

...

further arguments passed to or from methods.

method

either "long" or "wide", determining the shape of the output:

  • "long": a data.frame with one row for each observation for each time series in x. The data.frame has four columns denoting the source of each observation (i.e. from which row and column of x is the observation from?), the observation time, and the observation value.

  • "wide": a data.frame with one column for each time series in x.

Note

Only time series with atomic observation values can be coerced to a data.frame.

This method is helpful for saving a multivariate time series to a human-readable text file.

See Also

The uts_matrix_long and uts_matrix_wide constructors provide the opposite functionality, i.e. they convert data in long and wide format, respectively, to a uts_matrix.

Examples

1
2

andreas50/utsMultivariate documentation built on Sept. 27, 2021, 10:33 p.m.