[R] peering inside functions in a package?

Uwe Ligges ligges at statistik.tu-dortmund.de
Sun May 19 00:49:03 CEST 2013



On 17.05.2013 12:57, Duncan Murdoch wrote:
> On 13-05-16 9:56 PM, Seth Myers wrote:
>> Let's say I would like to look inside the function corBrownian in library
>> (ape).  When I type in the function name I get the following, which is
>> not
>> nearly the detail that goes into this function.  I am wondering how to
>> begin cracking this function open (and others) so I can learn more
>> about it
>> and perhaps code my own corClass one day.  Thanks.
>>
>>> corBrownian
>> function (value = 1, phy, form = ~1)
>> {
>>      if (!inherits(phy, "phylo"))
>>          stop("object \"phy\" is not of class \"phylo\"")
>>      attr(value, "formula") <- form
>>      attr(value, "fixed") <- TRUE
>>      attr(value, "tree") <- phy
>>      class(value) <- c("corBrownian", "corPhyl", "corStruct")
>>      value
>> }
>> <environment: namespace:ape>
>
> That's it.  Why do you think something is missing?

I guess the OP is wondering about printed or plotted output and should 
look into the corresponding print or plot methods, but then, we need 
some more information to be able to help here.

Best,
Uwe Ligges

>
> Duncan Murdoch
>
> ______________________________________________
> 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.



More information about the R-help mailing list