compound() creates a Compounding object in one of its subclasses: Simple, Discrete, Continuous.

compounding(x = c("simple", "discrete", "continuous"))

Arguments

x

a character with the name of compounding regime: simple, discrete, continuous

Value

A subclass of Compounding object.

Details

A Compounding object can be instanciated with the compounding function, passing a string with the name of one of the compounding regimes: simple, discrete, continuous.

Examples

compounding("simple")
#> <compounding: simple > 
compounding("discrete")
#> <compounding: discrete > 
compounding("continuous")
#> <compounding: continuous > 

comp <- compounding("discrete")
compound(comp, 0.06, 2) # equals (1 + 0.06) ^ 2 = 1.1236
#> [1] 1.068138
implied_rate(comp, 1.1236, 2) # equals 0.06
#> [1] 0.8531716