fortify.ts: Convert time-series-like to data.frame

View source: R/base_fortify_ts.R

fortify.tsR Documentation

Convert time-series-like to data.frame

Description

Convert time-series-like to data.frame

Usage

## S3 method for class 'ts'
fortify(
  model,
  data = NULL,
  columns = NULL,
  is.date = NULL,
  index.name = "Index",
  data.name = "Data",
  scale = FALSE,
  melt = FALSE,
  ...
)

Arguments

model

time-series-like instance

data

original dataset, if needed

columns

character vector specifies target column name(s)

is.date

logical frag indicates whether the stats::ts is date or not If not provided, regard the input as date when the frequency is 4 or 12

index.name

specify column name for time series index

data.name

specify column name for univariate time series data. Ignored in multivariate time series.

scale

logical flag indicating whether to perform scaling each timeseries

melt

logical flag indicating whether to melt each timeseries as variable

...

other arguments passed to methods

Value

data.frame

Examples

## Not run: 
fortify(AirPassengers)
fortify(timeSeries::as.timeSeries(AirPassengers))
fortify(tseries::irts(cumsum(rexp(10, rate = 0.1)), matrix(rnorm(20), ncol=2)))
fortify(stats::stl(UKgas, s.window = 'periodic'))
fortify(stats::decompose(UKgas))

## End(Not run)

ggfortify documentation built on May 29, 2024, 7:19 a.m.