From bhs2 at mevik.net  Tue Aug 31 09:49:20 2004
From: bhs2 at mevik.net (=?iso-8859-1?q?Bj=F8rn-Helge_Mevik?=)
Date: Tue Aug 31 09:49:27 2004
Subject: [Rd] Dimension of apply(X, MARGIN, FUN) when FUN returns a matrix
Message-ID: <m0r7pn3fy7.fsf@bar.nemo-project.org>

Dear all,

apply(X, MARGIN, FUN, ...) returns an array of dimension
c(n, dim(X)[MARGIN]) when FUN returns a vector of length n > 1.

Matrices and arrays are also vectors, so if FUN returns a matrix or an
array, apply returns an array of dimension c(n, dim(X)[MARGIN]) as
above.  This is in accordance with the description of apply in the
Blue Book, and also how Splus works (at least v6.0).

I am curious: why was it decided not to return an array of dimension
c(dim(result.of.FUN), dim(X)[MARGIN]) when FUN returns a matrix or an
array?

(This is not meant as criticism.  I am sure there is a good reason; I
just cannot see it.)

-- 
Bj?rn-Helge Mevik


[Rd] Dimension of apply(X, MARGIN, FUN) when FUN returns a matrix
=?iso-8859-1?q?Bj=F8rn-Helge_Mevik?=