ytoypc {tframe} | R Documentation |
Convert level data to year over year percent change.
ytoypc(obj, names = paste("y to y %ch", seriesNames(obj))) ## Default S3 method: ytoypc(obj, names = paste("y to y %ch", seriesNames(obj)))
obj |
A time series object. |
names |
names for the new series (but is 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.
A time series vector or matrix.
z <- matrix(100 + rnorm(200),100,2) z[z == 0] <- 1 # not to likely, but it can happen z <- ytoypc(z)