我正在尝试查看源代码。例如,对于cook.distance()。这就是我试过的
cooks.distance
function (model, ...)
UseMethod("cooks.distance")
<bytecode: 0x3f25b5c>
<environment: namespace:stats>
然后我尝试了:
debug(cooks.distance)
一无所获。然后我试了一下:
methods(cooks.distance)
[1] cooks.distance.glm* cooks.distance.lm*
Non-visible functions are asterisked
然后我尝试了:
lm:::cooks.distance.default
Error in loadNamespace(name) : there is no package called ‘lm’
有人告诉我lm是在MASS包中所以我尝试了以下内容:
MASS:::cooks.distance.default
Error in get(name, envir = asNamespace(pkg), inherits = FALSE) :
object 'cooks.distance.default' not found
如何查看源代码?我试着查看源代码但找不到函数?
答案 0 :(得分:3)
试试这个:
getAnywhere(cooks.distance.glm)
从这里开始:http://cran.r-project.org/doc/manuals/R-intro.html#Object-orientation