Learn R Programming

ggfortify (version 0.4.17)

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

Description

Convert time-series-like to data.frame

Usage

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

Value

data.frame

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

Examples

Run this code
if (FALSE) {
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))
}

Run the code above in your browser using DataLab