On Wed, Apr 23, 2008 at 4:23 PM, Mike Dugas <[EMAIL PROTECTED]> 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/ ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.