dataWithLagNames {lagged}R Documentation

Lagged data with named lag dimension

Description

Get the data from a Lagged object and ensure that the lag dimension is named

Usage

dataWithLagNames(object, prefix = "Lag_")

Arguments

object

an object inheriting from "Lagged".

prefix

a character string.

Details

dataWithLagNames() extracts the data part from a lagged object and gives names to the lag dimension, if it is not already named.

This function is mainly used for programming, particularly in show() methods for lagged objects..

Value

The data part with names as described in Details.

Author(s)

Georgi N. Boshnakov

Examples

x <- Lagged(drop(acf(ldeaths, plot = FALSE)$acf))
## there are no names for the lags:
names(x) # NULL
## but the print method inserts default "Lag_N" names
x
## This sets the names to their defaults:
x1 <- dataWithLagNames(x)
names(x1)
## ... and this sets non-default prefix:
x2 <- dataWithLagNames(x, "L")
names(x2)
x2

[Package lagged version 0.3.2 Index]