Re: [R] How to vectorize a function to handle two vectors

2011-08-27 Thread Jeff Newmiller
Isn't a vector of vectors usually considered a matrix? So if you want to vectorize a vector function you would normally rewrite it to operate on matrices. --- Jeff Newmiller The . . Go Live...

[R] How to vectorize a function to handle two vectors

2011-08-26 Thread Newbie
Dear R-users I am trying to vectorize a function so that it can handle two vectors of inputs. I want the function to use phi (a function), k[1] and t[1] for the first price, and so on for the second, third and fourth price. I tried to do the mapply, but I dont know how to specify to R what input

Re: [R] How to vectorize a function to handle two vectors

2011-08-26 Thread David Winsemius
On Aug 26, 2011, at 2:43 PM, Newbie wrote: Dear R-users I am trying to vectorize a function so that it can handle two vectors of inputs. I want the function to use phi (a function), k[1] and t[1] for the first price, and so on for the second, third and fourth price. ? mapply I tried

Re: [R] How to vectorize a function to handle two vectors

2011-08-26 Thread Newbie
Thank you for the quick response! I think you are on the right track - but is there any way of calling (is that the word for it) the function price_call in the mapply, so that this price_call function is changed to handle vectors. I believe that this should, in theory if it is correct, make the

Re: [R] How to vectorize a function to handle two vectors

2011-08-26 Thread David Winsemius
On Aug 26, 2011, at 4:52 PM, Newbie wrote: Thank you for the quick response! I think you are on the right track - but is there any way of calling (is that the word for it) the function price_call in the mapply, so that this price_call function is changed to handle vectors. I believe that