> Would you like existing functions such as mean, range, sum,
> colSums, dim, apply, length, and many more to operate on the array of
> numbers? If so use an S3 class.
The above is misleading as 'setClass("NewArray", [additional structures
go in here], contains="array")' will give the NewArray a
On Jan 7, 2008 2:34 PM, John Chambers <[EMAIL PROTECTED]> wrote:
> One thing you cannot do in S3 is to have methods that depend on anything
> but the first argument.
Actually, you can. Here are two examples.
> ### first example - Axis ###
> ### note that it can be dispatched on x or at
> Axis
fu
On Jan 7, 2008 1:34 PM, John Chambers <[EMAIL PROTECTED]> wrote:
> Prof Brian Ripley wrote:
> > On Mon, 7 Jan 2008, Robin Hankin wrote:
> >
> >
> >> I am writing a package and need to decide whether to use S3 or S4.
> >>
> >> I have a single class, "multipol"; this needs methods for "[" and "[<-"
>
Would you like existing functions such as mean, range, sum,
colSums, dim, apply, length, and many more to operate on the array of
numbers? If so use an S3 class.
If you would like to effectively disable such functions, to prevent
them from working on the object unless you write a method that spec
In EBImage I have a very similar situation (well, with more methods). It
would be impossible to use S3 in my case as my data structures are
images and I need at least two dimensions (but in fact use 3), thus 2
variables to dispatch on in [, which are defined for multiple
configurations like int
Prof Brian Ripley wrote:
> On Mon, 7 Jan 2008, Robin Hankin wrote:
>
>
>> I am writing a package and need to decide whether to use S3 or S4.
>>
>> I have a single class, "multipol"; this needs methods for "[" and "[<-"
>> and I also need a print (or show) method and methods for arithmetic +-
>>
On Mon, 7 Jan 2008, Robin Hankin wrote:
> I am writing a package and need to decide whether to use S3 or S4.
>
> I have a single class, "multipol"; this needs methods for "[" and "[<-"
> and I also need a print (or show) method and methods for arithmetic +-
> */^.
>
> In S4, an object of class "mu
I am writing a package and need to decide whether to use S3 or S4.
I have a single class, "multipol"; this needs methods for "[" and "[<-"
and I also need a print (or show) method and methods for arithmetic +-
*/^.
In S4, an object of class "multipol" has one slot that holds an array.
Objects o