[Rd] Controlling simplification in apply()?

Gavin Simpson gavin.simpson at ucl.ac.uk
Mon Feb 20 17:03:51 CET 2012

Dear list,

Fully according to the documented behaviour, I was bitten by apply()
simplifying results to vectors or arrays when the lengths of the
individual objects returns by FUN are the same (over simplification).

sapply() has argument simplify with default TRUE to control whether it
attempts to simplify the returned objects or not.

I do find it a little annoying that one is not able to force apply into
one behaviour or the other.

Would the be merit in apply() also having a similar argument to control
whether simplification occurs or not, say adding `simplify = TRUE` after
`...`? If there was I'd be happy to provide a first stab and contribute
updated documentation.

All the best,

 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk

More information about the R-devel mailing list