R/spotrate-class.R
, R/spotratecurve-class.R
, R/forwardrate-class.R
as.spotrate.Rd
Coerce character objects to SpotRate class
as.spotrate(x, ...)
# S4 method for character
as.spotrate(x, simplify = TRUE)
# S4 method for SpotRateCurve
as.spotrate(x, ...)
# S4 method for ForwardRate
as.spotrate(x, ...)
a character with SpotRate specification.
additional arguments
a boolean indicating whether to simplify SpotRate creation or not. Defaults to TRUE.
A SpotRate
object created from a string.
The character representation of a SpotRate is as follows:
"RATE COMPOUNDING DAYCOUNT CALENDAR"
where:
RATE
is a numeric value
COMPOUNDING
is one of the following:
simple
, discrete
, continuous
DAYCOUNT
is a valid day count rule, pex. business/252
,
see Daycount.
CALENDAR
is the name of a bizdays calendar.
simplify
check if compounding, daycount and calendar are the same for
all given characters.
If it is true the returned object is a SpotRate otherwise a list
with
SpotRate objects is returned.
as.spotrate(c(
"0.06 simple actual/365 actual",
"0.11 discrete business/252 actual"
))
#> [[1]]
#> [1] "0.06 simple actual/365 actual"
#>
#> [[2]]
#> [1] "0.11 discrete business/252 actual"
#>