- We aim to present a simple retirement calculation
- Provided the amount you save yearly, how many years you will work and a expected return rate it calculates the resulting ammount.
Leonardo
Data Science apprendice
Provided you work may not give you a retirement plan you may need to do some regular saving to ensure you will not starve when you're older.
This app provide a simple calculation for the ammount you may need to save.
The calculations use some basic financial math, the concept of compound interest.
It calculates the compound interest considering a constant deposit.
The code is as follows:
retirement <- function(age, savings, endage, interest){
ages_to_work <- endage - age
total_money <- 0
for(i in 1:ages_to_work){
total_money <- total_money + savings
total_money <- total_money*( 1.00 + interest/100)
}
return(total_money)
}
I hope you find this useful. Enjoy!