R/accumulation_function.R

#' @title The accumulation function shows what $1 grows to after any length of time.
#'
#' @description
#' source: https://en.wikipedia.org/wiki/Compound_interest
#'
#' @param t is the overall length of time the interest is applied (expressed using the same time units as r, usually years).
#' @param r is the nominal annual interest rate is the nominal annual interest rate (as percent e.g. 4.5).
#' @param n is the compounding frequency.
#'
#' @return An accumulation multiple.
#'
#' @examples
#' accumulation_function(20, 0.045, 4)
#'
#' @export
accumulation_function <- function(t, r, n) {
  r <- r / 100
  (1 + r / n)^(n * t)
}
pgstevenson/borrowr documentation built on May 15, 2019, 10:02 p.m.