View source: R/percentage_change.R
percentage_change | R Documentation |
Function to calculate percentage change between new and old values.
percentage_change(previous, new, as_decimal = FALSE)
previous |
Previous or older value. |
new |
Newer value. |
as_decimal |
Should the percentage be represented in a 0 to 1 scale? |
Numeric vector.
Stuart K. Grange
percentage_difference
# Simple calculations
percentage_change(100, 50)
percentage_change(50, 100)
# Global mean CO2 mole fraction
percentage_change(277, 400)
percentage_change(277, 400, as_decimal = TRUE)
# Percentage change depends on the order of the inputs because it depends on
# the denominator
percentage_change(104, 130)
percentage_change(130, 104)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.