to_percent_change: Convert decimals difference to percent differences.

Description Usage Arguments Details Value Examples

Description

Converts a list of decimal numbers (e.g. 0.7, 1.0, 1.3) to their corresponding percent difference representation. The representation will depend on what value is selected as the baseline, i.e. 0% percent change.

Usage

1
to_percent_change(decimal_list, baseline = 1)

Arguments

decimal_list

The list to convert.

baseline

The value that represents 0% percent change.

Details

This function uses round() to avoid any weird floating point representation errors. Because of this, the best precision you can obtain is integers for your percent differences (e.g. can only get "52

Value

A list of the same length as decimal_list.

Examples

1
2
3
4
## Not run: to_percent_change(seq(0.5,1.5,by=0.1))
to_percent_change(seq(-0.3,0.7,by=0.1),baseline=0)
to_percent_change(seq(0.512,1.512,by=0.1)) # answer is rounded
## End(Not run)

tbadams45/wrviz documentation built on May 31, 2019, 3:58 a.m.