It is the time interval used in calculations with interest rates. The Term class represents the period used to discount or compound a spot rate.
The Term object is defined by its numeric value and its unit, that can be
"days"
, "months"
or "years"
.
For example:
term(6, "months")
#> [1] "6 months"
It represents a period of 6 months. The Term object can also be created from a string representation of a Term.
as.term("6 months")
#> [1] "6 months"
Since the Term object inherits from a numeric
, it inherits all numeric
operations.
Numeric values can be summed or subtracted from a Term object numeric part.
term(1, "days") + 1
#> [1] "2 days"
Arithmetic and comparison operations between Term object are not implemented, so these operations raise an error.
try(term(1, "days") + term(2 , "days"))
#> Error in term(1, "days") + term(2, "days") : Not implemented