[R] Operating on windows of data
Richard A. O'Keefe
ok at cs.otago.ac.nz
Tue Mar 23 02:16:11 CET 2004
Martin Maechler <maechler at stat.math.ethz.ch> wrote that
[using apply functions is] not [better than using loops],
not at all.
He would be right in all he says if time efficiency were the only
reason to prefer one coding style to another.
Loop-free notatation can reduce the number of variables in scope,
making the code easier to read and rearrange. By separating "what to
do with the elements" from "how to find the elements", it can lead to
pieces which are separately reusable. By reducing the volume of
code, it can result in code with fewer mistakes.
(Note the word "can" in each of those sentences.)
More information about the R-help
mailing list