spotrate-compare-method {fixedincome} | R Documentation |
SpotRate comparison operations
Description
Comparison operations with SpotRate class
SpotRate
objects can be compared among themselves or with numeric
variables.
Usage
## S4 method for signature 'SpotRate,SpotRate'
e1 >= e2
## S4 method for signature 'SpotRate,SpotRate'
e1 <= e2
## S4 method for signature 'SpotRate,SpotRate'
e1 < e2
## S4 method for signature 'SpotRate,SpotRate'
e1 > e2
## S4 method for signature 'SpotRate,SpotRate'
e1 == e2
## S4 method for signature 'SpotRate,SpotRate'
e1 != e2
## S4 method for signature 'SpotRate,numeric'
Compare(e1, e2)
## S4 method for signature 'numeric,SpotRate'
Compare(e1, e2)
Arguments
e1 |
a |
e2 |
a |
Value
A boolean logical
object.
The comparison with SpotRate
objects only takes all fields
into account.
Comparing SpotRate
against numeric values is equivalent to
coerce the SpotRate
object to numeric execute the operation,
this is a syntax sugar for a shortcut that is commonly applied.
Examples
spr <- as.spotrate("0.06 simple actual/365 actual")
spr == 0.06
spr != 0.05
spr > 0.05
spr < 0.1
spr >= 0.05
spr <= 0.1
spr1 <- spotrate(0.06, "simple", "actual/365", "actual")
spr2 <- spotrate(0.02, "simple", "actual/365", "actual")
spr1 == spr2
spr1 != spr2
spr1 > spr2
spr1 < spr2
spr1 >= spr2
spr1 <= spr2
# compare spotrate with different slots
spr2 <- spotrate(0.06, "discrete", "actual/365", "actual")
spr1 == spr2
spr1 != spr2
try(spr1 > spr2)
try(spr1 < spr2)
try(spr1 >= spr2)
try(spr1 <= spr2)
[Package fixedincome version 0.0.5 Index]