[Rd] S4 methods and polymorophism

Eric Lecoutre lecoutre at stat.ucl.ac.be
Wed Sep 22 11:20:09 CEST 2004



At 10:52 22/09/2004, Matthias.Kohl at uni-bayreuth.de wrote:
>I think, it must be x instead of object?
>
>setMethod("length", signature(x="Collection"), function(x) length(x at ID))

Hi,

This is right, this latest works - Thank you.

For "show" methods, I did understand I had to use "object" with

---
 > getGeneric("show")
standardGeneric for "show" defined from package "methods"

function (object)
standardGeneric("show")
<environment: 017E6D18>
Methods may be defined for arguments: object
---

I didn't have the same information for "length"... except in the help page 
of the function length which provides the list of its arguments, so that I 
should have found that myself.
Anyway, thank you very much: now at least I have understand that argument 
names must exactly match argument names of the generic and my knowledge of 
S4 classes is better.

Eric



More information about the R-devel mailing list