[R] lapply and paste
tlumley at uw.edu
Wed Mar 28 21:19:24 CEST 2012
On Thu, Mar 29, 2012 at 7:44 AM, Ed Siefker <ebs15242 at gmail.com> wrote:
> Thank you, I was confused about that. What exactly is lapply for then,
> if R handles this kind of thing automatically? Are there functions that are
> not "vectorized"?
There are, especially ones you write yourself that don't need to be
vectorised on all their arguments.
Also, there may be more than one direction to vectorise: eg mean or
median work on vectors, but need some form of loop to work on data
frames (lapply, apply, for)
And there are structures too complicated to put in a vector: if I have
a list of linear models and want the variance-covariance matrices from
each one, lapply() is a good way to do it.
Professor of Biostatistics
University of Auckland
More information about the R-help