On Nov 23, 2012, at 12:35 PM, Sam Steingold wrote:

* R. Michael Weylandt <zvpunry.jrlyn...@tznvy.pbz> [2012-11-23 09:13:36 +0000]:

2. because difftime.summary returns a data.frame and not a
"Classes 'summaryDefault', 'table'" as I assume summary must return.

See 
http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-should-I-write-summary-methods_003f

what are the requirements on the class summary.foo?

I'm not sure it makes sense to frame the question this way. summary.foo would nt be a class but rather a 'summary' method/function that applied to items of class 'foo.

does it have to inherit from some other class?

There is implicit inheritance from the vector "class" and sometimes default methods will assume a numeric vector. But if you defin an object to be of a particular class, it would not need to have an explicit inheritance defined/

how do I define a class?

That's pretty easy. Read:

?class         # and the pages to which it links.

(And also read ?methods, and the pages to which it links. Then read Sect 5 Object-oriented programming in the "R Language Definition".)

--

David Winsemius, MD
Alameda, CA, USA

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to