lagged_change: Calculate the change along a vector

View source: R/lagged_change.R

lagged_changeR Documentation

Calculate the change along a vector

Description

lagged_change() calculates the change between consecutive lagged values of x. cumulative_change() calculates the change between the first value of x and each subsequent value of x.

Usage

lagged_change(x, type = "percent")

cumulative_change(x, type = "percent")

Arguments

x

Numeric vector

type

Type of change to calculate. Either "percent" or "absolute"

Value

Numeric vector of the same length as x

Author(s)

Shona Wilde


shonawilde/shonarrr documentation built on Jan. 29, 2025, 1:27 a.m.