CAGR {COINr} | R Documentation |
Given a variable y
indexed by a time vector x
, calculates the compound annual growth rate. Note that CAGR assumes
that the x
refer to years. Also it is only calculated using the first and latest observed values.
CAGR(y, x)
y |
A numeric vector |
x |
A numeric vector of the same length as |
A scalar value (CAGR)
# random points over 10 years
x <- 2011:2020
y <- runif(10)
CAGR(y, x)