perc_change: Calculate percentage change

Description Usage Arguments Details Warning Examples

View source: R/perc_change.R

Description

perc_change returns the percentage change between two values, where one value (old.value) is used as a baseline to compare the change with.

Usage

1
perc_change(old.value, new.value, print.result = "value")

Arguments

old.value

(numeric) The baseline for the comparison.

new.value

(numeric) The value which is compared to the baseline.

print.result

(character) Either "value", "percentage", or "text".

Details

The output can be specified via the print.result parameter. Options are the raw value, transformed to percentage, or a text description. Default settings return the raw value.

Warning

perc_change is vectorized and shorter values are recycled. If the length of old.value differs from the length of print.result, please confirm that the code is doing the desired task by double-checking with print.result = "text".

Examples

1
perc_change(7, 5, print.result = "text")

Ischi94/palint documentation built on Feb. 7, 2021, 4:37 a.m.