discount_cashflow: Discount Cashflow

Description Usage Arguments Examples

View source: R/discount_cashflow.R

Description

This function discounts a cash flow with the interest and return the net present value (NPV). The function assumes that the first period of df is period zero in the npv calculation, thus the cash flows in this period is not discounted.

Usage

1
discount_cashflow(df, cf, rate, period)

Arguments

df

Data frame with cash flow, interest rate and period

cf

Cash flow

rate

Interest rate

period

Period, e.g. year.

Examples

1
2
3
4
5
6
7
df <- tibble(
cf = c(100, 200, 300),
rate = c(0.05, 0.10, 0.20),
period = c(2020, 2021, 2022)
)

df_npv <- discount_cashflow(df, cf, rate, period)

eysteinmeese91/magimisc documentation built on Oct. 3, 2020, 10:10 a.m.