Let’s suppose that there is a family that has the following debts:
Using R, an amortization table will be produced for each of the 3 aforementioned debts. Lastly, the total debt and payments will be displayed in a table.
What are some methods to deal with our debt(s)?
Please note: Just because a method is listed below, it does not mean that Irucka Embry believes that it is a wise strategy or not. Depending on whichever method that you may use, you may want to consult with a lawyer, a certified public accountant (CPA), a financial advisor/professional, a tax advisor, a life insurance agent, etc. depending on your (or your client’s) situation.
Note: If you wish to replicate the R code below, then you will need to copy and paste the following command in R first to make sure you have all the packages and their dependencies installed:
install.packages(c("data.table", "pander", "priceR", "DT"))
# install the packages and their dependencies (including any system
# dependencies)
Note: If you wish to replicate the R code below, then you will need to copy and paste the following commands in R first to make sure you have all the packages loaded:
# load the required packages
install.load::load_package("data.table", "pander", "priceR", "DT")
# load needed packages using the load_package function from the install.load
# package (it is assumed that you have already installed these packages)
# set the pander options
panderOptions("table.continues", "")
panderOptions("table.caption.prefix", "")
panderOptions("missing", "")
In the near future, the code from Source 1 will be incorporated into the amortization_calculator function that will be in a future release of iemisc (https://gitlab.com/iembry/iemisc).
# Debt Balances
mortgage <- 256957
loans <- 145528
credit_cards <- 18673.65
# Debt Interest Rates
mortgage_rate <- 9.83 # %
loan_rate <- 9.47 # %
credit_card_rate <- 14.26 # %
# create the amortization table using the amort function
mortgage_amortization <- amort(principal = mortgage, interest = mortgage_rate, duration = 30,
payfreq = 1, firstpay = 1, compoundfreq = 1)
# create a data.table of the result
mortgage_amortization <- setDT(mortgage_amortization)
# change the column names
setnames(mortgage_amortization, c("Month", "Payment", "Total Paid", "Principal Balance"))
# copy mortgage_amortization to avoid potential issues in the last table
mortgage_amortizations <- copy(mortgage_amortization)
# add in the currency symbol for the last 3 columns
change <- c("Payment", "Total Paid", "Principal Balance")
for (col in change) {
set(mortgage_amortizations, j = col, value = format_dollars(mortgage_amortizations[[col]],
digits = 2))
# Source 2
}
# print the table
datatable(mortgage_amortizations)