[R] Inspecting R functions

Duncan Murdoch murdoch at stats.uwo.ca
Mon Jan 3 13:01:42 CET 2005


On Mon, 03 Jan 2005 10:50:22 +0000, Richard Dybowski
<richard at inferspace.com> wrote:

>In S-Plus, I can look at the structure of a function (for example, hist) 
>simply by entering
>         hist <RETURN>
>however, if I do this in R, I get the response
>         function (x, ...)
>         UseMethod("hist")
>         <environment: namespace:graphics>
>How can I inspect the structure of a function in R?

It's the same as in S-PLUS, what you saw *is* the structure of hist in
R, i.e. it is an S3 generic.

To see the implementation for a particular class, you need to say
which method you want to look at, and then use getS3method to see it.
For example,

getS3method('hist', 'default')

shows the default method.

Duncan




More information about the R-help mailing list