A function in the
*apply family is an abstraction of a
for loop. Compared with the
*apply functions have the following advantages:
for loops are more general and can give us more control allowing to achieve complex computations that are not always trivial to do using
The relationship between
for loops and
*apply functions is explained in the documentation for
*apply family of functions contains several variants of the same principle that differ based primarily on the kind of output they return.
|vector or matrix (depending on the length of each element returned)|
|vector or ||vector or matrix (depending on the length of each element returned)|
|vector or |
|vector or `list||vector or matrix (depending on the length of each element returned) of the user-designated class|
|multiple vectors, |
See "Examples" to see how each of these functions is used.