ts_reshape {TSstudio}R Documentation

Transform Time Series Object to Data Frame Format

Description

Transform time series object into data frame format

Usage

ts_reshape(ts.obj, type = "wide", frequency = NULL)

Arguments

ts.obj

a univariate time series object of a class "ts", "zoo", "xts", and the data frame family (data.frame, data.table, tbl, tibble, etc.) with a Date column and at least one numeric column. This function support time series objects with a daily, weekly, monthly or quarterly frequencies

type

The reshape type -

"wide" set the years as the columns and the cycle units (months or quarter) as the rows, or

"long" split the time object to year, cycle unit and value

frequency

An integer, define the series frequency when more than one option is avaiable and the input is one of the data frame family. If set to NULL will use the first option by default when applicable - daily = c(7, 365)

Examples


data(USgas)
USgas_df <- ts_reshape(USgas)

[Package TSstudio version 0.1.7 Index]