Skip to content
Prev 38754 / 63424 Next

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

> On Wed, Dec 1, 2010 at 3:39 AM, Martin Maechler
> <maechler at stat.math.ethz.ch> wrote:
>> My proposal -- implemented and "make check" tested -- is
    >> to add an optional argument ?'ARRAY' which allows
    >> 
    >>> sapply(v, myF, y = 2*(1:5), ARRAY=TRUE)

    > It would reduce the proliferation of arguments if the
    > simplify= argument were extended to allow this,
    > e.g. simplify = "array" or perhaps simplify = n would
    > allow a maximum of n dimensions.

That's a good idea, though it makes the
implementation/documentation very slightly more complicated.

I'm interested to get more feedback on my other questions,
notably the only about *changing*  vapply() (on the C-level) to
behave "logical" in the sense of adding one  dim(.)ension in
those cases, the FUN.VALUE (result prototype) has a dim().


Martin