[R] How to look up source code for cor.test()

Duncan Murdoch murdoch.duncan at gmail.com
Wed May 19 16:20:16 CEST 2010


On 19/05/2010 10:13 AM, Will Eagle wrote:
> Dear all,
>
> how can I check the source code for a hidden function like cor.test()?
>
> At the moment I get ...
>  > cor.test
> function (x, ...)
> UseMethod("cor.test")
> <environment: namespace:stats>
>
>   

There's nothing hidden, that is the source code.  What UseMethod() does 
depends on the class of x, so you want to look at the cor.test.<class> 
function as well, for the particular class.  Often those methods *are* 
hidden, so you may need something like

getAnywhere(cor.test.default)

to see one.

Duncan Murdoch



More information about the R-help mailing list