In a message dated 10/20/03 5:11:25 AM Pacific Daylight Time, [EMAIL PROTECTED] writes:
> Have you actually compared for loop with apply, in terms of timing? Have > you looked at the R code for apply()? It has: > > <...> > if (length(d.call) <2) { > if (length(dn.call)) > dimnames(newX) <- c(dn.call, list(NULL)) > for (i in 1:d2) ans[[i]] <- FUN(newX[, i], ...) > } > else for (i in 1:d2) ans[[i]] <- FUN(array(newX[, i], d.call, > dn.call), ...) > <...> > > Notice the for loop there! While what you said about apply and for loop > might be true for (older version of) Splus, it's not true for R. > > lapply() does do the looping at the C level. sapply and tapply uses lapply, > so they can be faster than for loop at the R level. > > Andy > I have not done the comparison. Thanks a lot for point this out. Anupam. [[alternative HTML version deleted]] ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help