View source: R/spotratecurve-class.R
spotratecurve | R Documentation |
spotratecurve()
S3 method createas a SpotRateCurve object.
It is dispatched for numeric values, that represent spot rates and
for SpotRate objects.
spotratecurve(x, terms, ..., refdate = Sys.Date())
## S3 method for class 'numeric'
spotratecurve(
x,
terms,
compounding,
daycount,
calendar,
refdate = Sys.Date(),
.copyfrom = NULL,
...
)
## S3 method for class 'SpotRate'
spotratecurve(x, terms, refdate = Sys.Date(), .copyfrom = NULL, ...)
x |
a numeric representing a spot rate value or a SpotRate object. |
terms |
a numeric vector with positive values representing the days of the term structure. |
... |
additional arguments |
refdate |
the curve reference date. |
compounding |
a character with the compouning name. |
daycount |
a character representing the daycount. |
calendar |
a calendar object. |
.copyfrom |
a SpotRate object that is used as reference to build the SpotRateCurve object. |
A SpotRateCurve
object.
terms <- c(1, 11, 26, 27, 28)
rates <- c(0.0719, 0.056, 0.0674, 0.0687, 0.07)
curve <- spotratecurve(rates, terms, "discrete", "actual/365", "actual")
# access the term 11 days
curve[[11]]
# access the second element
curve[2]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.