[R] How to show the definition of a S3 function?

David Winsemius dwinsemius at comcast.net
Wed Feb 3 06:06:36 CET 2010


On Feb 3, 2010, at 12:04 AM, David Winsemius wrote:

>
> On Feb 2, 2010, at 11:59 PM, Peng Yu wrote:
>
>> On Tue, Feb 2, 2010 at 10:52 PM, Jeff Laake <Jeff.Laake at noaa.gov>  
>> wrote:
>>> Try methods("contrast") to see functions.  Depends on class of  
>>> fit.  eg
>>> contrast.lm
>>
>> I tried the following command. How to get the definition of, say,  
>> contrast.lm?
>
> Just type:
>
> constrast.lm
contrast.lm          # obviously
>
> Unless the method is "*'ed, it will be available without using  
> getAnywhere(). See the R-news article by Ligges on accessing source.
>
>>
>>> methods("contrast")
>> [1] contrast.Design contrast.geese  contrast.gls    contrast.lm
>> [5] contrast.lme
>>> methods("contrast.lm")
>> no methods were found
>> Warning message:
>> In methods("contrast.lm") :
>> function 'contrast.lm' appears not to be generic
>>> contrast.lm
>> function (fit, ...)
>> contrastCalc(fit, ...)
>> <environment: namespace:contrast>
>>
>>
>>
>>
>>> On 2/2/2010 8:48 PM, Peng Yu wrote:
>>>>>
>>>>> library(contrast)
>>>>> contrast
>>>>>
>>>>
>>>> function (fit, ...)
>>>> UseMethod("contrast")
>>>> <environment: namespace:contrast>
>>>>
>>>> I guess the above function is S3. Could somebody let me know how to
>>>> show the function body in an R session?
>>>>
>>>> ______________________________________________
>>>> R-help at 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.
>>>>
>>>
>>
>> ______________________________________________
>> R-help at 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.
>
> David Winsemius, MD
> Heritage Laboratories
> West Hartford, CT
>
> ______________________________________________
> R-help at 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.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT



More information about the R-help mailing list