interest_fun: interest_fun - a while loop function for calculating compound...

Description Usage Arguments Source

View source: R/interest_while_fun.R

Description

Purpose: to calculate the final balance in a bank account and amount of years it would take to reach a certain target in an account where an initial investment earns compound interest. The function uses the compound interest formula and contains a while() loop which will continue to apply interest on a given investment until a given target balance is reached. It will report the amount of years it would take to reach that target balance and the actual final balance that is achieved at the end of the year in which the target was reached.

Usage

1
interest_fun(balance, target, interest_rate, compound_per_yr, yr)

Arguments

balance

the amount of money in a bank account. When setting this parameter, you are setting the amount of initial balance. The function then produces the final balance after applying compound interest for X years

interest_rate

the rate at which interest is being applied

compound_per_yr

the amount of times the balance is compounded per year. This typically should be set to 1 most of the time, but can be changed by user in situations where that is not the case

yr

number of years since the initial investment was made, the amount of time that balance has had time to gain interest. Starts with year 0 as the first year

Source

compound interest formula: https://www.thecalculatorsite.com/articles/finance/compound-interest-formula.php#:~:text=Compound%20interest%2C%20or%20'interest%20on,the%20number%20of%20time%20periods


anthonyluna/Assignment5 documentation built on March 22, 2021, 11:03 p.m.