yearFraction {RQuantLib} | R Documentation |
The yearFraction
function returns year fraction between two dates
given a day counter Enum
yearFraction(startDates, endDates, dayCounters)
startDates |
A vector of Date type. |
endDates |
A vector of Date type. |
dayCounters |
A vector of numeric type. See Enum |
The day counters are coming from QuantLib, and the QuantLib documentation should be consulted for details. See Enum and http://quantlib.org/reference/class_quant_lib_1_1_day_counter.html
A numeric vector contains year fractions between two dates from the input.
The interface might change in future release as QuantLib
stabilises its own API.
Dirk Eddelbuettel edd@debian.org for the R interface;
Khanh Nguyen nguyen.h.khanh@gmail.com for the implementation;
the QuantLib Group for QuantLib
http://quantlib.org for details on QuantLib
.
startDates <- seq(from=as.Date("2009-04-07"), to=as.Date("2009-04-14"), by=1) endDates <- seq(from=as.Date("2009-11-07"), to=as.Date("2009-11-14"), by=1) dayCounters <- c(0,1,2,3,4,5,6,1) yearFraction(startDates, endDates, dayCounters)