Re: Dimnamenames (PR#257)

About this list Date view Thread view Subject view Author view Other groups

Subject: Re: Dimnamenames (PR#257)
From: Jonathan Rougier (J.C.Rougier@durham.ac.uk)
Date: Thu 04 Nov 1999 - 02:33:19 EST


Message-ID: <Pine.GSO.3.96.991103161959.11496G-100000@laplace>

Hi Peter,

On Wed, 3 Nov 1999 p.dalgaard@biostat.ku.dk wrote:

> 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?

I'm not sure. Aren't you duplicating the functionality provided by the
drop flag? After all, if the names were important then presumably the
subscription would have been a[,1,1, drop=FALSE] anyhow. I like the
concept of a vector in this situation and suspect that in my lazy code I
have stuff that checks for a dim attribute whan checking arguments to
functions, which would be a problem. Perhaps it would be better to pass
the name as a different attribute, eg

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

But it would be great to have the names fixed!

Cheers, Jonathan.

Jonathan Rougier Science Laboratories
Department of Mathematical Sciences South Road
University of Durham Durham DH1 3LE

"[B]egin upon the precept ... that the things we see are to be
 weighed in the scale with what we know" (Meredith, 1879, The Egoist)

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b25 : Tue 04 Jan 2000 - 14:16:09 EST