pct_change: Percent Change Without Div by 0 Error

Description Usage Arguments Examples

View source: R/pct_change.r

Description

Calculates the percent change of two numbers or vectors, if prior = 0 then percent change is 100

Usage

1
pct_change(prior, current, format = T, ...)

Arguments

prior

A numeric object

current

A numeric object

format

If TRUE (default) then output is converted to a percentage with formattable, otherwise proportion

...

Any arguments passed to formattable::percent, most likely digits

Examples

1
2
pct_change(0, 1) returns 100.00%
pct_change(2, 3, format = F) returns 0.5

joshua-ruf/fidelis documentation built on July 20, 2019, 1:56 a.m.