Learn R Programming

fixedincome (version 0.0.5)

spotratecurve-helpers: SpotRateCurve helpers

Description

Helpers methods that return parts of a SpotRateCurve object according to a given term.

Usage

first(x, t)

last(x, t)

closest(x, t)

Value

A SpotRateCurve object that is a subset of the given curve. The elements returned are select according to the operation executed.

Arguments

x

a SpotRateCurve object.

t

a Term object.

first filters the first elements of the SpotRateCurve according to the given term.

last filters the last elements of the SpotRateCurve according to the given term.

closest selects the element of the SpotRateCurve that is the closest to the given term.

Examples

Run this code
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")
first(curve, "10 days")
last(curve, "10 days")
closest(curve, "10 days")

Run the code above in your browser using DataLab