Is there an variant of apply() that does not return anything?
On Thu, Nov 19, 2009 at 2:21 PM, Peng Yu <pengyu.ut at gmail.com> wrote:
There are a few version of apply() (e.g., lapply(), sapply()). I'm
wondering if there is one that does not return anything but just
silently apply a function to the list argument.
For example, the plot function is applied to each element in 'alist'.
It is redundant to return anything from apply.
apply(alist,function(x){ plot each element of alist})
Take a look at the l_ply(), a_ply() and d_ply() functions from Hadley's "plyr" package. They are a refinement and extension to the apply family of functions and the underscore, "_", in the function names indicates that they have no return value. -Charlie