s-news
[Top] [All Lists]

[S] Classes and Objects in Sv4

To: Splus News <s-news@wubios.wustl.edu>
Subject: [S] Classes and Objects in Sv4
From: Baz <B.Rowlingson@lancaster.ac.uk>
Date: Wed, 23 Feb 2000 14:10:39 +0000
Sender: owner-s-news@wubios.wustl.edu

 I've had enough tearing my hair out trying to understand
chapter 7 of Programming With Data. Any better guides to
S version 4 class/method programming out there?

 Specifically: can I create a class that behaves exactly
like a data frame, (ie generic functions call the data frame
method when called with it) unless a specific method for
my new class is defined. For example:

foo <- baz(x=1:10,y=runif(10))
 
 creates a new object of class 'baz'. Now this behaves
exactly like a data frame. But if I do:

setMethod("plot","baz",plot.baz)

 then it will now call plot.baz if I call plot(foo).

 Is this possible? I'm having no success - I've a feeling
a data.frame isnt an object in the same sense as some of
the other objects are. Does my class have to be defined
in terms of 'structure' or something?

 And one more point. Is there a way of removing 'Is' relations?
There appears to be no 'removeIs', 'deleteIs' or similar. Not 
even a 'SetIsnt'. Cant find it in the help docs either. Aaargh.

Barry Rowlingson
Maths and Stats
Lancaster University
Lancaster
UK
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>
  • [S] Classes and Objects in Sv4, Baz <=