partial matches for attribute name

Kurt Hornik Kurt.Hornik@ci.tuwien.ac.at
Fri, 10 Jul 1998 18:41:45 +0200 (CEST)


>>>>> Paul Gilbert writes:

>> o   attr() partial matches for attribute name.

> If this does what I think it does then I don't think it is a very good
> idea, and is also not consistent with S:

> In Splus I get
>> attr(diag(.5,3), "dim")
> [1] 3 3
>> attr(diag(.5,3), "di")
> NULL
>>

Which is clearly a bug.  The Splus documentation says,

       The semantics of attr are defined by saying  that  attr(x,
       which)  is equivalent to attributes(x)[[which]] for either
       extracting or replacing attributes, with  the  restriction
       that which is interpreted as mode character.  The value of
       attributes(x) is a list  object  (possibly  of  length  0)
       associated  implicitly  with  any object x.  See Subscript
       for the semantics of "[[".

and we have

> attributes(diag(.5,3))[["di"]]
[1] 3 3

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