View source: R/financial_functions.R
| fin_value_CAGR | R Documentation |
Calculates the constant, period-over-period growth rate required for an investment to grow from a beginning value to an ending value over a specified number of periods.
The Compound Annual Growth Rate (CAGR) is computed as: CAGR = (End value/Start value)^(1/t) - 1
Where t is the number of years (periods).
fin_value_CAGR(beginningValue, endingValue, numYears, digits = 3)
beginningValue |
Starting value of investment |
endingValue |
Ending value of investment |
numYears |
Number of periods (e.g., years) elapsing from begin to end |
digits |
rounding the returned value (default = 3) |
A numeric value representing the Compound Annual Growth Rate as a decimal (e.g., 0.096 for 9.6%).
This function includes input validation and will stop() with an error
if any inputs are non-numeric or non-positive.
Other financial functions:
fin_options_Greeks(),
fin_options_LeapSimulate(),
fin_options_plotGreeks(),
fin_options_teach(),
fin_stock_CAGR(),
fin_stock_justifiedPE(),
fin_stock_target(),
fin_stock_ticker(),
fin_stock_valuation(),
fin_tax_FIF(),
fin_tax_NI(),
fin_value_CarryCost(),
fin_value_NPV(),
fin_value_interest(),
fin_value_percent()
rate = fin_value_CAGR(beginningValue = 100, endingValue = 190, numYears = 7)
print(rate)
# --- Example with a Loss ---
fin_value_CAGR(100, 50, 5)
# --- Formatting as Percentage ---
percent = paste0(round(rate * 100, 2), "%")
print(percent)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.