3

我正在尝试查看源代码。例如对于 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

如何查看源代码?我试图查看源代码但找不到函数?

4

1 回答 1

3

试试这个:

getAnywhere(cooks.distance.glm)

从这里:http ://cran.r-project.org/doc/manuals/R-intro.html#Object-orientation

于 2013-03-22T20:25:21.763 回答