From timh at insightful.com  Mon Feb 25 17:28:17 2008
From: timh at insightful.com (Tim Hesterberg)
Date: Mon, 25 Feb 2008 08:28:17 -0800
Subject: [Rd] Standard method for S4 object
In-Reply-To: <47C06F0A.4090505@u-paris10.fr> (message from Christophe Genolini
	on Sat, 23 Feb 2008 20:07:54 +0100)
References: <47C06F0A.4090505@u-paris10.fr>
Message-ID: <uy79957by.fsf@insightful.com>

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 additional
methods defined for inheriting classes.

In cases like this you might prefer using an S3 class, using
attributes rather than slots for auxiliary information, so that
you don't need to write so many methods.

Tim Hesterberg

>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 define these 3 methods and of course, a get and a 
>set for each slot. What else? Is there some other methods that a R user 
>can reasonably expect? Some "minimum basic tools"...
>
>Thanks
>
>Christophe



[Rd] Standard method for S4 object
Tim Hesterberg