Skip to content

Instantly share code, notes, and snippets.

@raadk
raadk / excelFinance.R
Last active September 11, 2023 10:01
Excel's PMT, IPMT, PPMT implemented in R
#' Excel: PMT (should make result data frame, but need to change propertyAnalysis())
#'
#' Returns the payment amount for a loan based on a constant interest rate and a constant payment schedule.
#' The payment returned by PMT includes principal and interest but no taxes,
#' reserve payments, or fees sometimes associated with loans.
#' Outgoing payments are displayed by negative numbers and
#' incoming payments by positive numbers.
#' #http://support2.microsoft.com/kb/214005#appliesto
#' @param rate Required. The interest rate per period. Needs to be defined as the same periods as nper.
#' @param per Required. The period for which you want to find the interest and must be in the range 1 to nper.