Alexander Klar
January 2, 2017
Create a small application including a GUI, that calculates and visualizes the results (including final balance) of a monthly savings plan.
The user can choose:
30 years, 100 Euro, 1st of each month, annual return of 6 %:
paid <- 1200 # 12*100 Euro
oneYear <- 1200 + 6.5 * 6 * 100 / 100
totalBalance <- oneYear
savingsDF <- data.frame(year = 1, ammountPaid = paid, totalBalance = totalBalance )
for(i in 2:30){
paid <- paid + 1200
totalBalance <- totalBalance * (1 + 6/100) + oneYear
savingsDF[i,] <- c(i, paid, totalBalance) }
head(savingsDF,2) # show first 2 entries
year ammountPaid totalBalance
1 1 1200 1239.00
2 2 2400 2552.34
r <- barplot(savingsDF$totalBalance/1000, names.arg = savingsDF$year, main = "Total Balance in 1000 €",
xlab = "Years", ylim = c(0, totalBalance/800), col = "blue")
lines(r, savingsDF$ammountPaid/1000, type = "h", col = "red", lwd = 4)
Here's the link: https://alklar.shinyapps.io/monthly_savings_plan/
If you have comments or questions, reach out to me.
The source code is available here: https://github.com/alklar/savings_plan