[R-pkg-devel] run a function from a list

Glenn Schultz glennmschultz at me.com
Sat May 27 14:49:04 CEST 2017


All,
I have a function to split a fixed rate bond into a floater/inverse floater combination (something typically done in mortgage securtizations).  The function returns a list which serves as the deal structure over which principal payment rules will iterate.  However, I would like to call the functions as they drive the interest coupon payments.  I am using paste0() to piece together the function and I think the problem is the quotes but not sure.

I have tried source, do.call, list$foo(), list[[]]().  None of these have worked.  Any advice on structuring this problem is appreciated.

Thanks,
Glenn

structure(list(floater.balance = 30.78, floater.cap = 6.66666666666667, 
floater.floor = 0.3, floater.index = "1mLIBOR", floater.formula = "function(index){min(6.67,max((1mLIBOR+0.3)0.3))}", 
inverse.balance = 20.52, inverse.cap = 9.55, inverse.multipler = 1.5, 
inverse.floor = 0, inverse.floater.formula = "(function(index) {min(9.55,max((-1.5*1mLIBOR)+9.55,0))})"), .Names = c("floater.balance", 
"floater.cap", "floater.floor", "floater.index", "floater.formula", 
"inverse.balance", "inverse.cap", "inverse.multipler", "inverse.floor", 
"inverse.floater.formula"))






More information about the R-package-devel mailing list