Re: [R] Where to declare S4 classes?

From: Seth Falcon <>
Date: Mon 06 Mar 2006 - 04:22:21 EST

Hi Patrick,

Patrick Giraudoux <> writes:
> OK. Looks like I have got it... going through the source code of sp,
> classes are declared as usual functions in *.R files.

I'll add in a few suggestions that I have found useful for developing heavily S4 classes (you don't have to do it this way, your life may not be better if you do, etc):

File organization:


Why do I find this helpful?

With all of the classes in one place it is easy to see what *things* the package defines, how they are structured, and how they relate to each other. Similarly, having all the generics in one place provides a nice overview of the behaviors defined by the package.

Methods separate from the classes makes sense because in S4 methods don't belong to classes. Since classes and methods are decoupled in S4, it makes sense to me to organize them that way in the source code.


+ seth mailing list PLEASE do read the posting guide! Received on Mon Mar 06 04:55:56 2006

This archive was generated by hypermail 2.1.8 : Mon 06 Mar 2006 - 06:09:05 EST