From lecoutre at stat.ucl.ac.be  Wed Sep 22 11:20:09 2004
From: lecoutre at stat.ucl.ac.be (Eric Lecoutre)
Date: Wed Sep 22 11:23:53 2004
Subject: [Rd] S4 methods and polymorophism
In-Reply-To: <1124.132.180.246.60.1095843123.squirrel@mail.uni-bayreuth.
 de>
References: <6.0.1.1.2.20040922095129.02d97608@stat4ux.stat.ucl.ac.be>
	<200409221037250788.0078AC6D@mail.math.fu-berlin.de>
	<1124.132.180.246.60.1095843123.squirrel@mail.uni-bayreuth.de>
Message-ID: <6.0.1.1.2.20040922111519.02dc9ce0@stat4ux.stat.ucl.ac.be>



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


[Rd] S4 methods and polymorophism
Eric Lecoutre