Learn R Programming

onlineforecast (version 0.9.3)

as.data.list.data.frame: Convertion of data.frame into data.list

Description

Convert a data.frame into a data.list

Usage

# S3 method for data.frame
as.data.list(object)

Arguments

object

The data.frame to be converted.

Value

a data.list

Details

The convention is that columns with forecasts are postfixed with .kxx where xx is the horizon. See the examples.

See Also

as.data.list

Other as.data.list: as.data.list()

Examples

Run this code
# NOT RUN {
# Convert a dataframe with time and two observed variables
X <- data.frame(t=1:10, x=1:10, y=1:10)
as.data.list(X)

# Convert a dataframe with time, forecast and an observed variable
X <- data.frame(t=1:10, x.k1=1:10, x.k2=10:1, yobs=1:10, y.k1=1:10, y.k2=1:10)
as.data.list(X)

# Can be converted back and forth
X
as.data.frame(as.data.list(X))

# }

Run the code above in your browser using DataLab