Re: [R] Vectorizing a function: what does it mean?

2011-05-09 Thread Duncan Murdoch
On 09/05/2011 11:57 AM, Ron Michael wrote: Dear all, I would really appreciate if somebody can help me to understand what does the phrase "Vectorize your function" mean? And what is the job of Vectorize() function in doing that? I have read many threads where experts suggest to Vectorize the f

Re: [R] Vectorizing a function: what does it mean?

2011-05-09 Thread Duncan Murdoch
On 09/05/2011 1:31 PM, David Winsemius wrote: On May 9, 2011, at 11:57 AM, Ron Michael wrote: > Dear all, I would really appreciate if somebody can help me to > understand what does the phrase "Vectorize your function" mean? And > what is the job of Vectorize() function in doing that? I have

Re: [R] Vectorizing a function: what does it mean?

2011-05-09 Thread David Winsemius
On May 9, 2011, at 11:57 AM, Ron Michael wrote: Dear all, I would really appreciate if somebody can help me to understand what does the phrase "Vectorize your function" mean? And what is the job of Vectorize() function in doing that? I have read many threads where experts suggest to Vector

Re: [R] Vectorizing a function that needs to access previous elements of a row

2010-11-20 Thread Joshua Wiley
Hi Amol, It depends on your exact needs, but one way, assuming you do not need to access previous calculations, only previous elements: x <- 1:10 x[-10] / x[-1] The idea is first create a vector, x, then using negative indices, select the first 9 elements of x (i.e., 1:9) to be divded by the las

Re: [R] vectorizing a function

2009-07-07 Thread Bert Gunter
?ifelse Bert Gunter Genentech Nonclinical Biostatistics -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Steve Jaffe Sent: Tuesday, July 07, 2009 12:42 PM To: r-help@r-project.org Subject: [R] vectorizing a function I'm sure I'm mi

Re: [R] vectorizing a function

2009-07-07 Thread Greg Snow
For this case it is quite simple, see ?ifelse > z <- ifelse( x > 0, y, -y ) Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun.

Re: [R] vectorizing a function (NEVERMIND)

2009-07-07 Thread Steve Jaffe
Nevermind, indeed it is obvious: Vectorize ! Steve Jaffe wrote: > > I'm sure I'm missing something obvious but I'm not seeing how to simply > "vectorize" a function of two or more variables. > -- View this message in context: http://www.nabble.com/vectorizing-a-function-tp24380064p24380136