ts_reshape: Transform Time Series Object to Data Frame Format

View source: R/util_functions.R

ts_reshapeR 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)

RamiKrispin/TSstudio documentation built on Aug. 28, 2023, 11:08 a.m.