Learn R Programming

tsmethods (version 1.0.2)

tsconvert.tsmodel.distribution: Convert a distribution object to a long form data.table

Description

Converts an object of class “tsmodel.distribution” or “tsmodel.distribution_list” to a long form data.table object.

Usage

# S3 method for tsmodel.distribution
tsconvert(object, to = "data.table", name = NULL, ...)

# S3 method for tsmodel.distribution_list tsconvert(object, to = "data.table", ...)

Value

a data.table object

Arguments

object

a “tsmodel.distribution” or “tsmodel.distribution_list” object.

to

output format. Currently only “data.table” supported.

name

an optional string for the name of the series which will be added to the table (only for the “tsmodel.distribution”, as the list object is already validated with names).

...

not currently used.

Examples

Run this code
x1 <- matrix(rnorm(100), 10, 10)
colnames(x1) <- as.character(as.Date(1:10, origin = "1970-01-01"))
class(x1) <- "tsmodel.distribution"
head(tsconvert(x1, name = "SeriesA"))

Run the code above in your browser using DataLab