[R] split / lapply over multiple columns

Peter Dalgaard pdalgd at gmail.com
Thu Aug 5 08:46:48 CEST 2010


Ralf B wrote:
> Besides beauty, is there an actual advantage in terms of run-time
> and/or memory use?

If you look at the actual definition of tapply, I'm sure you realize
that the answer is no:

    ans <- lapply(split(X, group), FUN, ...)

inbetween 40-odd lines of "red tape" is something of a giveaway...


-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list