Discount a Quantity Over Time. Should be a scalar if time is specified, a vector otherwise
Source:R/utils.R
discount.Rd
Discount a Quantity Over Time. Should be a scalar if time is specified, a vector otherwise
Details
If the unit of discount rate is the year and a cycle duration is 1 month, period should be 12.
Examples
discount(rep(10, 5), .02)
#> [1] 10.000000 9.803922 9.611688 9.423223 9.238454
discount(rep(10, 5), .02, first = FALSE)
#> [1] 10.000000 9.803922 9.611688 9.423223 9.238454
discount(1000, .05, time = 10)
#> [1] 644.6089
discount(1000, .05, period = 2, time = 1:10)
#> [1] 1000.0000 1000.0000 952.3810 952.3810 907.0295 907.0295 863.8376
#> [8] 863.8376 822.7025 822.7025
discount(1000, .05, period = 2, time = 1:10, linear = TRUE)
#> [1] 1000.0000 975.9001 952.3810 929.4286 907.0295 885.1701 863.8376
#> [8] 843.0192 822.7025 802.8754