Shiny Application and Reproducible Pitch: Loan Installment Calculator

Radu-Ionel TOMA
17.01.2023

Overview

This presentation and the 'Loan Installment Calculator' application were created by Radu-Ionel Toma as an assignment in the Coursera' course titled 'Developing Data Products'.

The application was developed using 'Shiny' library and 'RStudio' and implementing the 'PMT' function for calculating the monthly loan payment.

The application can be found here.

The presentation was created using 'RStudio Presenter' s

Shiny Application: Loan Installment Calculator

The application Loan Installment Calculator can be used for calculating the Monthly Installment to a loan and the Total interest to be paid for the given loan.

The application contain widgets input: textbox, slider, button, makes operations on the ui.R input in sever.R and have a reactive output displayed as a result of server calculations.

The application is hosted on shinyapps.io server.

Instructions: Loan Installment Calculator

For the calculation of the Monthly Installment to a loan and the Total interest to be paid, the user has to provide the following variables:

  • Loan amount
  • Loan Term in months
  • Annual Interest Rate

The application has default values, but the user can change them. Once the new variables are provided, the 'Calculate' button should be pressed.

Embedded R code

Below is an example of the PMT function implemented in R:

## The PMT calculation Function:
## https://support.microsoft.com/en-us/office/pmt-function-0214da64-9a63-4996-bc20-214433fa6441
## PMT=(pv*rate)/(1-(1+rate)^(-nper))

#       "pv"   = "Loan Amount"
#       "nper" = "Term (months)"
#       "rate" = "Annual interest rate"      

PMT <- function(rate, nper, pv) {
        r <- rate/(12*100)
        t <- nper
        P <- (pv*r)/(1-(1+r)^(-t))
        return(P)
}

# Ouput of the PMT function for some variable
PMT(7, 12, 10000)
[1] 865.2675