[Rd] RFC: sapply() limitation from vector to matrix, but not further

Hadley Wickham hadley at rice.edu
Wed Dec 1 19:51:54 CET 2010


> A downside of that approach is that lapply(X,...) can
> cause a lot of unneeded memory to be allocated (length(X)
> SEXP's).  Those SEXP's would be tossed out by simplify() but
> the peak memory usage would remain high.  sapply() can
> be written to avoid the intermediate list structure.

But the upside is reusable code that can be used in multiple places -
what about the simplification code used by mapply and tapply? Why are
there three different implementations of simplification?

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



More information about the R-devel mailing list