On Thu, Mar 29, 2012 at 7:44 AM, Ed Siefker <ebs15...@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. -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.