I'm currently studying R. In particular I need to remember the functions in the apply
-function family (e.g. lapply
, sapply
, mapply
, etc.). I know what each function in the apply
-function family does (especially this answer helps a lot), but mix up the names from time to time.
Is there a natural meaning for the prefix of each apply function (like lapply = 'list'-apply
)?
Yes, you got following apply
r-basic functions:
apply
for apply ;) lapply
for lists or vectors (documentation)vapply
for specific return value (documentation)
sapply
for simple (documentation)
mapply
for multiple list or vector arguments (documentation)
tapply
for table (check old question here)
rapply
for recursive (documentation)
I think you can interprete some prefix differently, like m
was mentioned in the commentary as multivariate (commentary got removed). I tried to use the wording of the documentation, so it's more likely to be understood.
Also lapply
, sapply
and vapply
are in the same documentation site, since the sapply
and vapply
are wrapper for lapply