cid-methods: Check whether a 'RiskFactorConnector' contains a certain...

containsIDR Documentation

Check whether a RiskFactorConnector contains a certain 'key'

Description

For each element of the what parameter a logical is returned indicating whether (TRUE) or not (FALSE) the RiskFactorConnector contains an object with the same key.

Usage

containsID(object, id, ...)

## S4 method for signature 'RiskFactorConnector,character'
containsID(object, id)

Arguments

object

The RiskFactorConnector object

...
what

A character (vector) containing keys to be checked

Value

logical indicating whether or not a key exists

See Also

add, remove

Examples

yc <- YieldCurve() # create a YieldCurve object
tenors <- c("1W", "1M", "6M", "1Y", "2Y", "5Y")
rates <- c(0.001, 0.0015, 0.002, 0.01, 0.02, 0.03)
set(yc, what = list(MarketObjectCode = "YC_Prim",
    Nodes = list(ReferenceDate = "2015-01-01", 
    Tenors = tenors, Rates = rates)))

ind <- Index() # create a ReferenceIndex object
times <- c("2015-01-01", "2016-01-01", "2017-01-01", "2018-01-01",
           "2019-01-01")
values <- c(100, 110, 120, 130, 140)
set(ind, what=list(MarketObjectCode = "CHF_SMI",
    Data=list(Dates=times,Values=values)))
    
fx <- FxRate() # create an FX-Rate object
times <- c("2015-01-01", "2016-01-01", "2017-01-01", 
           "2018-01-01", "2019-01-01")
values <- c(1.04, 1.05, 1.2, 1.0, 0.9)
set(fx, what=list(MarketObjectCode = "CHF/USD",
    Data=list(Dates=times,Values=values)))   
    
rf <- RFConn() # create a RiskFactorConnector object
add(rf,list(yc,ind,fx)) # add all risk factors to the RiskFactorConnector
containsID(rf, c("YC_Prim", "CHF_SMI", "YC_2"))


wbreymann/FEMS documentation built on Dec. 8, 2022, 9:43 a.m.