Re: [Rd] Standard method for S4 object

2008-02-26 Thread Thibaut Jombart
Oleg Sklyar wrote: > similar. S3 gives more freedom in assigning new attributes, but this > freedom also means that one has little control over the structure of an > object making it, for example, more difficult to use with C/C++ code. > Are there any specific benefits in not using S4 and slots

Re: [Rd] Standard method for S4 object

2008-02-25 Thread Tim Hesterberg
Hi Oleg, If there as a class to inherit from, then my point about an S4 class requiring lots of methods is moot. I think it would come down then to whether one prefers flexibility (advantage S3) or a definite structure for use with C/C++ (advantage S4). Tim >well, I am not arguing that there ar

Re: [Rd] Standard method for S4 object

2008-02-25 Thread Oleg Sklyar
Hi Tim, well, I am not arguing that there are situation when one needs to rewrite everything from scratch. However it is always worth at least considering inheritance if there is a candidate to inherit from. It saves a lot of work. Anyway, your examples of S3 class usage are obviously valid in

Re: [Rd] Standard method for S4 object

2008-02-25 Thread Tim Hesterberg
>Tim Hesterberg wrote: >> It depends on what the object is to be used for. >> >> If you want users to be able to operate with the object as if it >> were a normal vector, to do things like mean(x), cos(x), etc. >> then the list would be very long indeed; for example, there are >> 225 methods for t

Re: [Rd] Standard method for S4 object

2008-02-25 Thread Oleg Sklyar
Hi Tim Tim Hesterberg wrote: > It depends on what the object is to be used for. > > If you want users to be able to operate with the object as if it > were a normal vector, to do things like mean(x), cos(x), etc. > then the list would be very long indeed; for example, there are > 225 methods for

Re: [Rd] Standard method for S4 object

2008-02-25 Thread Tim Hesterberg
It depends on what the object is to be used for. If you want users to be able to operate with the object as if it were a normal vector, to do things like mean(x), cos(x), etc. then the list would be very long indeed; for example, there are 225 methods for the S4 'bdVector' class (in S-PLUS), plus

Re: [Rd] Standard method for S4 object

2008-02-24 Thread Christophe Genolini
For what I understand so far : For set, you can add some verification of object internal coherance. The initialize make verification when you create your object, aSlotName<- can make some verification when you change your slot. For get, you can build some more elabored method than just getting a

Re: [Rd] Standard method for S4 object

2008-02-24 Thread Katharine Mullen
I don't know of any '"non official list" of what method a new S4 object should have' - such a list would have to depend on what the object represents. If it represents the output of fitting a model, then methods for 'residuals', 'fitted' and 'coefficients' would probably be nice. Also, out of cu

[Rd] Standard method for S4 object

2008-02-24 Thread Christophe Genolini
Hi the list, I am defining a new class. Shortly, I will submit a package with it. Before, I would like to know if there is a kind of "non official list" of what method a new S4 object should have. More precisely, personally, I use 'print', 'summary' and 'plot' a lot. So for my new class, I defi