Learn R Programming

tsbox (version 0.3.1)

ts_pc: First Differences and Percentage Change Rates

Description

ts_pcy and ts_diffy calculate the percentage change rate and the difference compared to the previous period, ts_pcy and ts_diffy calculate the percentage change rate compared to the same period of the previous year. ts_pca calculates annualized percentage change rates compared to the previous period.

Usage

ts_pc(x)

ts_diff(x)

ts_pca(x)

ts_pcy(x)

ts_diffy(x)

Value

a ts-boxable time series, with the same class as the input.

Arguments

x

ts-boxable time series, an object of class ts, xts, zoo, data.frame, data.table, tbl, tbl_ts, tbl_time, tis, irts or timeSeries.

Examples

Run this code
tail(ts_diff(ts_c(fdeaths, mdeaths)))
tail(ts_pc(ts_c(fdeaths, mdeaths)))
tail(ts_pca(ts_c(fdeaths, mdeaths)))
tail(ts_pcy(ts_c(fdeaths, mdeaths)))
tail(ts_diffy(ts_c(fdeaths, mdeaths)))

Run the code above in your browser using DataLab