Avoiding "for" loops with "apply" is one thing ... But can one avoid using apply? and gain even more efficiency?
e.g. instead of for (i in 1:(ncol(x)-1)) y[i] = mean(x[,i:(i+1)]) can be replaced with y = sapply(1:(ncol(x)-1), FUN=function(i) { mean(x[,i:(i+1)]) } ) but how can apply be avoided to gain efficiency in this case? in any case? ================================================================= Instructions for joining and leaving this list, remarks about the problem of INAPPROPRIATE MESSAGES, and archives are available at http://jse.stat.ncsu.edu/ =================================================================