Re: [R] Deleting for() loop in function

2007-10-10 Thread Duncan Murdoch
On 10/10/2007 2:03 PM, Alberto Monteiro wrote: > Jim Holtman wrote: >> >> One of the things that you should do is to use Rprof >> to see where time is being spent. >> > Rprof is great! I didn't know such functionality existed. > > But I am a very destructive user; I think I found a way > to break

Re: [R] Deleting for() loop in function

2007-10-10 Thread jim holtman
There are a couple of outputs from Rprof. One shows time spent in the function (and everything that it calls) and the other in the function itself. What I do is to post process the output from Rprof into a format that is easier to understand. In this case, the Rprof run took 12.2 seconds of whic

Re: [R] Deleting for() loop in function

2007-10-10 Thread Alberto Monteiro
Jim Holtman wrote: > > One of the things that you should do is to use Rprof > to see where time is being spent. > Rprof is great! I didn't know such functionality existed. But I am a very destructive user; I think I found a way to break Rprof: if I do f <- my.slow.function then call f(...)

Re: [R] Deleting for() loop in function

2007-10-10 Thread jim holtman
One of the things that you should do is to use Rprof to see where time is being spent. I would guess that is the not the 'for' loop, but instead what is being done inside it. My guess it that most of the time is being spent in the number of times that 'lp' is being called. So the real problem mig

[R] Deleting for() loop in function

2007-10-10 Thread Dong-hyun Oh
Dear UseRs, I wrote following function in order to solve Data Envelopment Analysis. Reason for posting is that the function is slow when nrow(dat) is large. I wonder if other functions could substitute the for() loop in the code, such as mapply(). Can anybody help to rewrite the dea() function