Learn R Programming

ggseas (version 0.4.0)

tsdf: Time series to data frame

Description

Convert a ts object to data.frame with columns for time period and the original data

Usage

tsdf(timeseries, colname = "x")

Arguments

timeseries
an object of class ts or mts
colname
Column name to give to the time period column

Value

a data.frame with the same number of rows as the original time series

Details

A convenience function to create a data frame from a time series or multiple time series object. The motivation is to make it easy to pass time series data to functions that need data frames such as ggplot2.

Examples

Run this code
head(tsdf(AirPassengers))

ld <- cbind(fdeaths, mdeaths)
head(tsdf(ld))

Run the code above in your browser using DataLab