dear R experts: I want to define a function the calculates the black-scholes value. it takes 5 named parameters, BS <- function(S,K,dt,rf,sigma) {} . let's presume I want to be able to call this not only with my 5 numeric vectors BS( sigma=0.3, S=100, K=100, dt=1, rf=0.1 ) and BS( 100, 100, 1, 0.1, 0.3), but also with a data frame that contains the variables alll in a neat data frame already, BS( data.frame( S=100, K=100, dt=1, rf=0.1, sigma=0.3 )). I could of course define BS6 and BS1, but it would be nice to wrap this functionality into one function that can do both.
I know that BS has to parse an '...' argument, but there could be a couple of magical R functions that might make this easier than I would do it with my planned clunky version. what's the elegant version? /iaw ---- Ivo Welch (ivo.we...@gmail.com) ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.