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

Martin Maechler maechler at stat.math.ethz.ch
Tue Dec 28 16:49:49 CET 2010

>>>>> Gabor Grothendieck <ggrothendieck at gmail.com>
>>>>>     on Mon, 27 Dec 2010 17:06:25 -0500 writes:

    > 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().


More information about the R-devel mailing list