[R] finding a faster way to do an iterative computation

2008-07-29 Thread dxc13
useR's, I am trying trying to find out if there is a faster way to do a certain computation. I have successfully used FOR loops and the apply function to do this, but it can take some time to fully compute, but I was wondering if anyone may know of a different function or way to do this: x [1]

Re: [R] finding a faster way to do an iterative computation

2008-07-29 Thread Christos Hatzis
matrix(rep(x, each=13) - xk, nrow=13) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of dxc13 Sent: Tuesday, July 29, 2008 2:13 PM To: r-help@r-project.org Subject: [R] finding a faster way to do an iterative computation useR's, I am trying

Re: [R] finding a faster way to do an iterative computation

2008-07-29 Thread Rolf Turner
On 30/07/2008, at 6:12 AM, dxc13 wrote: useR's, I am trying trying to find out if there is a faster way to do a certain computation. I have successfully used FOR loops and the apply function to do this, but it can take some time to fully compute, but I was wondering if anyone may

Re: [R] finding a faster way to do an iterative computation

2008-07-29 Thread Moshe Olshansky
Try abs(outer(xk,x,-)) (see ?outer) --- On Wed, 30/7/08, dxc13 [EMAIL PROTECTED] wrote: From: dxc13 [EMAIL PROTECTED] Subject: [R] finding a faster way to do an iterative computation To: r-help@r-project.org Received: Wednesday, 30 July, 2008, 4:12 AM useR's, I am trying trying to

Re: [R] finding a faster way to do an iterative computation

2008-07-29 Thread dxc13
Thank you to all who applied. These all seem to work the way I want them to. The outer function seems really useful, I probably could use that for a lot of my work. Thanks! Rolf Turner-3 wrote: On 30/07/2008, at 6:12 AM, dxc13 wrote: useR's, I am trying trying to find out if there