From A.Buness at dkfz-heidelberg.de  Mon Aug 11 11:15:42 2003
From: A.Buness at dkfz-heidelberg.de (A.Buness@dkfz-heidelberg.de)
Date: Mon Aug 11 10:15:18 2003
Subject: [Rd] (PR#3690) wish in more detail
Message-ID: <200308110815.h7B8FgJH008268@pubhealth.ku.dk>

I will try to clarify my wish regarding apply.

My wish is related to the dimension attribute of an object.
Of course by the nature of apply the dimension may change,
but as you can see in my artifical examples below the same 
apply-operation applied to a matrix does behave differently 
to that respect.

> dim(matrix(0,nrow=1,ncol=1))
[1] 1 1
> dim(apply(matrix(0,nrow=1,ncol=1),1,function(x) return(x)))
NULL


> dim(matrix(0,nrow=2,ncol=1))
[1] 2 1
> apply(matrix(0,nrow=2,ncol=1),1,function(x) return(x))
[1] 0 0
> dim(apply(matrix(0,nrow=2,ncol=1),1,function(x) return(x)))
NULL


> dim(matrix(0,nrow=1,ncol=2))
[1] 1 2
> dim(apply(matrix(0,nrow=1,ncol=2),1,function(x) return(x)))
[1] 2 1


In these examples I would expect "matrix-dimensions" for 
all cases instead of no dimensions at all in the first
two cases. A follow up apply-operation (expecting a matrix 
like object will fail) and programming is laborious.
This is the reason why I am asking for an extension
of apply like "drop=FALSE" as it exists for subsetting 
of arrays.


[Rd] (PR#3690) wish in more detail
A.Buness@dkfz-heidelberg.de