From p.dalgaard@biostat.ku.dk  Wed Nov  3 15:56:25 1999
From: p.dalgaard@biostat.ku.dk (p.dalgaard@biostat.ku.dk)
Date: Wed, 3 Nov 1999 16:56:25 +0100 (MET)
Subject: Dimnamenames (PR#257)
Message-ID: <199911031556.QAA23767@pubhealth.ku.dk>


I've just started digging into Andreas's old report:

> a <- array(0,c(2,2,2));
> dimnames(a)<-list(hansi=1:2, pepi=c("a","b"), karli=3:4)
>  dimnames(a[,,1]) # losing component names
[[1]]
[1] "1" "2"

[[2]]
[1] "a" "b"

Now, this would be fairly easily fixed (I think) which would also make
it compatible with S3. But what should one do about a[,1,1]?  This
would generally be a vector with a .Names attribute, onto which there
is no way of attaching a name. The obvious idea would be to force it
to be a 1d array instead, i.e.

structure(c(0,0), .Dim = 2, .Dimnames = structure(list(hansi=c("1","2")))) 

rather than

structure(c(0,0), .Names = c("1","2"))

Does this sound safe? Generally, such 1-d arrays behave like vectors,
and noone has reported trouble with the fact that the result of table
can be a 1d array. From some viewpoints it seems odd to have different
behaviour depending on whether something is named or not, but it
*would* be nice to have the label retained on rows extracted from a
table...

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


Dimnamenames (PR#257)
p.dalgaard@biostat.ku.dk