Thanks for the help.  That explains why my time testing showed no
difference.  Is there any way to speed up the program?  It is unbearably
slow if I increase the number of loops.

Mike


On Wed, Apr 23, 2008 at 6:23 PM, hadley wickham <h.wickham@gmail.com> wrote:

> On Wed, Apr 23, 2008 at 4:23 PM, Mike Dugas <mikedugas77@gmail.com> wrote:
> > The answer to my post is yes (which I just figured out).
> >
>
> Switching from for to apply isn't going to speed up your code.  If you
> carefully read the source code of apply, you'll see the guts of the
> work is done by:
>
>  for (i in 1:d2) {
>        tmp <- FUN(array(newX[, i], d.call, dn.call), ...)
>        if (!is.null(tmp))
>            ans[[i]] <- tmp
>    }
>
> i.e apply uses for internally.  The reason to use apply instead of a
> for loop is so that you can better express the intent of your
> algorithm.
>
> Hadley
>
>
> --
> http://had.co.nz/
>

	[[alternative HTML version deleted]]

