[R] peering inside functions in a package?

Duncan Murdoch murdoch.duncan at gmail.com
Fri May 17 12:57:45 CEST 2013

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?

Duncan Murdoch

More information about the R-help mailing list