From hadley at rice.edu  Wed Dec  1 19:51:54 2010
From: hadley at rice.edu (Hadley Wickham)
Date: Wed, 1 Dec 2010 18:51:54 +0000
Subject: [Rd] RFC: sapply() limitation from vector to matrix,
	but not further
In-Reply-To: <77EB52C6DD32BA4D87471DCD70C8D70003B1D5BD@NA-PA-VBE03.na.tibco.com>
References: <19702.2469.739772.13707@lynne.math.ethz.ch>
	<AANLkTi=H9k-HSuyqk=XwMm_hmwoc_WOU3azjYnUmAkFP@mail.gmail.com>
	<77EB52C6DD32BA4D87471DCD70C8D70003B1D5BD@NA-PA-VBE03.na.tibco.com>
Message-ID: <AANLkTi=L6H3z6YT+nuKkQsGiVTShQekroK8q28zAXOEV@mail.gmail.com>

> 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/



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