Re: [Rd] S4 assignment \alias and \usage

From: Paul Gilbert <pgilbert_at_bank-banque-canada.ca>
Date: Wed, 30 May 2007 13:37:26 -0400

Seth Falcon wrote:
> Paul Gilbert <pgilbert@bank-banque-canada.ca> writes:
>

>> Let me back up a bit, I may be making another mistake.  My code has
>>
>> setGeneric("TSdoc<-",
>>    def= function(x, value) standardGeneric("TSdoc<-"),
>>    useAsDefault= function (x, value) {attr(x, "TSdoc") <- value ; x })
>>
>> setGeneric("TSdoc",
>>    def= function(x) standardGeneric("TSdoc"),
>>    useAsDefault= function(x) attr(x, "TSdoc"))

>
> Aside:
>
> It seems odd to me to define such defaults. How do you know x is
> going to have a TSdoc attribute?

attr returns NULL if the attibute does not exist so, in my S3 way of thinking, it seems very natural. Now knowing only a very little about S4 classes, I can see you might think it is odd.

Paul


La version franšaise suit le texte anglais.


This email may contain privileged and/or confidential inform...{{dropped}}



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed 30 May 2007 - 17:40:36 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 30 May 2007 - 20:35:58 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.