Compute present and future value of cash flow/stream, payback period, net present value, internal rate of return, equivalent annual annuity, profitability and break even period.

`Cashflow`

An R6 class

- cash_flow
Cash flow.

- interest_rate
Interest rate.

- discount_rate
Discount rate.

- years
Number of years.

- cf_stream
Cash flow stream.

- capital_cost
Cost of capital.

`$new()`

will instantiate an object of class `Cashflow`

.

`set_cash_flow()`

will set the value for `cash_flow`

.

`set_interest_rate()`

will set the value for `interest_rate`

.

`set_discount_rate()`

will set the value for `discount_rate`

.

`set_years()`

will set the value for `years`

.

`set_cf_stream()`

will set the value for `cf_stream`

.

`set_capital_cost()`

will set the value for `capital_cost`

`compute_fv()`

will compute the future value of a cash flow.

`compute_pv()`

will compute the present value of a cash flow.

`compute_fv_stream()`

will compute the future value of a cash flow stream.

`compute_pv_stream()`

will compute the present value of a cash flow stream.

`compute_payback_period()`

will compute the payback period of a project.

`compute_npv()`

will compute the net present value.

`compute_eaa()`

will compute the equivalent annual annuity.

`compute_profit_index()`

will compute profitability.

`compute_break_even()`

will compute the break even period.

# compute future value of a cash flow myCashflow <- Cashflow$new() myCashflow$set_cash_flow(100) myCashflow$set_interest_rate(10) myCashflow$set_years(4) myCashflow$compute_fv()#> [1] 146.41# compute present value of a cash flow myCashflow <- Cashflow$new() myCashflow$set_cash_flow(39) myCashflow$set_discount_rate(11.56) myCashflow$set_years(7) myCashflow$compute_pv()#> [1] 18.13448# compute future value of a cash flow stream myCashflow <- Cashflow$new() myCashflow$set_cf_stream(c(100, 200, 200, 300)) myCashflow$set_interest_rate(10) myCashflow$compute_fv_stream()#> [1] 895.1# compute present value of a cash flow stream myCashflow <- Cashflow$new() myCashflow$set_cf_stream(c(100, 200, 200, 300)) myCashflow$set_discount_rate(10) myCashflow$compute_pv_stream()#> [1] 611.3653# capital budgeting myCashflow <- Cashflow$new() myCashflow$set_cash_flow(c(-1000, 500, 400, 300, 200, 100)) myCashflow$set_capital_cost(10) myCashflow$compute_payback_period()#> [1] 3myCashflow$compute_npv()#> [1] 209.2132myCashflow$compute_eaa()#> [1] 55.18992myCashflow$compute_profit_index()#> [1] 1.209213myCashflow$compute_break_even()#> [1] 3