Re: [R] multiple versions of function

2013-01-10 Thread William Dunlap
> Behalf > Of ivo welch > Sent: Wednesday, January 09, 2013 1:00 PM > To: David Winsemius > Cc: r-help > Subject: Re: [R] multiple versions of function > > mea culpa. > > f <- function(...) { > ## parse out the arguments and then do something with them >

Re: [R] multiple versions of function

2013-01-10 Thread Michael Weylandt
On Jan 9, 2013, at 9:00 PM, ivo welch wrote: > mea culpa. > > f <- function(...) { > ## parse out the arguments and then do something with them > } > > ## all of these should result in the same actions > f(2,3) ## interprets a to be first and b to be second > f(a=2,b=3) > f(b=3,a=2) These

Re: [R] multiple versions of function

2013-01-09 Thread ivo welch
mea culpa. f <- function(...) { ## parse out the arguments and then do something with them } ## all of these should result in the same actions f(2,3) ## interprets a to be first and b to be second f(a=2,b=3) f(b=3,a=2) f(data.frame(a=2,b=3)) f(data.frame(b=3,a=1)) On Tue, Jan 8, 2013 at 8:0

Re: [R] multiple versions of function

2013-01-09 Thread David Winsemius
On Jan 9, 2013, at 1:00 PM, ivo welch wrote: > mea culpa. > > f <- function(...) { > ## parse out the arguments and then do something with them > } > > ## all of these should result in the same actions > f(2,3) ## interprets a to be first and b to be second > f(a=2,b=3) > f(b=3,a=2) > f(data.

Re: [R] multiple versions of function

2013-01-08 Thread David Winsemius
On Jan 7, 2013, at 6:58 PM, ivo welch wrote: hi david---can you give just a little more of an example? the function should work with call by order, call by name, and data frame whose columns are the names. /iaw It is I who should be expecting you to provide an example. -- David.

Re: [R] multiple versions of function

2013-01-07 Thread ivo welch
hi david---can you give just a little more of an example? the function should work with call by order, call by name, and data frame whose columns are the names. /iaw Ivo Welch (ivo.we...@gmail.com) On Mon, Jan 7, 2013 at 4:25 PM, David Winsemius wrote: > > On Jan 7, 2013, at 3:57 PM, iv

Re: [R] multiple versions of function

2013-01-07 Thread David Winsemius
On Jan 7, 2013, at 3:57 PM, ivo welch wrote: > 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

[R] multiple versions of function

2013-01-07 Thread ivo welch
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