From murdoch at stats.uwo.ca  Tue Sep 19 15:05:24 2006
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Tue, 19 Sep 2006 09:05:24 -0400
Subject: [Rd] Help for methods
In-Reply-To: <f8e6ff050609190552v34d29e95m4c62b9f8c7f3841e@mail.gmail.com>
References: <f8e6ff050609180824y1ca82a2cm3c3520ade980f7e8@mail.gmail.com>	<450FE1A3.8030808@cimr.cam.ac.uk>
	<f8e6ff050609190552v34d29e95m4c62b9f8c7f3841e@mail.gmail.com>
Message-ID: <450FEB14.1080409@stats.uwo.ca>

On 9/19/2006 8:52 AM, hadley wickham wrote:
>> You are supposed to do:
>>
>> ?summary.lm
>> ?summary.data.frame
>>
>> for S3 methods. The former works, the latter doesn't - which is
>> probably considered a bug, but then the usage of some of the
>> generics are probably considered obvious and fundamental enough
>> that summary.data.frame doesn't really behave in any substantially
>> different way compared to what is said in ?summary and ?Summary .
> 
> Well, I know that, and you know that, but how is anyone supposed to
> figure it out?  It means that you need to have a working knowledge of
> the S3 and S4 class systems before you can use the help to reliably
> get the documentation you need.

In the alpha of 2.4.0, both suggestions above work, as do ?summary and 
?summary(data.frame()).  ?summary(lm()) gives the same man page, rather
than the summary.lm page (but the page does have a link to that page).

The problem with S3 methods is that it's pretty difficult for R to know 
that a particular object is an S3 generic.  The only sign is that it has 
a call to UseMethod() in it.  I think this is one of the motivations for S4.

Duncan Murdoch




[Rd] Help for methods
Duncan Murdoch