ytoypc {tframe}R Documentation

Convert to year to year percent change

Description

Convert level data to year over year percent change.

Usage

    ytoypc(obj, names = paste("y to y %ch", seriesNames(obj)))
    ## Default S3 method:
    ytoypc(obj, names = paste("y to y %ch", seriesNames(obj)))

Arguments

obj A time series object.
names names for the new series (but is details).

Details

The result is a time series of the year over year percent change. This uses percentChange with lag=frequency(obj).

The names are not applied to the new series if the global option ModSeriesNames is FALSE. This can be set with options(ModSeriesNames=FALSE). This provides a convenient mechanism to prevent changing series labels on plot axis, when the title may indicate that data is in year-to-year percent change so the axis label does not need this.

Value

A time series vector or matrix.

See Also

percentChange

Examples

z <- matrix(100 + rnorm(200),100,2)
z[z == 0] <- 1 # not to likely, but it can happen
z <- ytoypc(z)

[Package tframe version 2006.4-1 Index]