spotrate-compare-method | R Documentation |
Comparison operations with SpotRate class
SpotRate
objects can be compared among themselves or with numeric
variables.
## 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)
e1 |
a |
e2 |
a |
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.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.