The "car" package in R has an interesting function called outlierTest and I want to analyze its source code to understand how it works. I tried the following and got an error:
getMethod("outlierTest")
Error in getMethod("outlierTest") :
no generic function found for 'outlierTest'
This seems to get me a response but it redirects me to a page with no source code displayed:
methods(outlierTest)
[1] outlierTest.lm*
see '?methods' for accessing help and source code
Finally, when typing only "outlierTest" in console I get no response:
outlierTest
function (model, ...)
{
UseMethod("outlierTest")
}
<bytecode: 0x000000000cf4d3d0>
<environment: namespace:car>
I appreciate any guidance on this.
You can do the following, at least with this package it works:
We look for the methods:
Particularly the method
outlierTest.lm
that has a*
according to the documentation:To retrieve in this case your code we can try this:
If not, the alternative is to directly access the project's github and, on time, you can retrieve this function at this link
An alternative is that you can access "unexported" functions (not visible in your namespace) with triple ":"
Remember that as you can see, the function
outlierTest
is generic and to access that in particular it applies to objects of the classlm
you must add a point:functiongenerica.clase
: