函数的源代码不是s4泛型

时间:2014-08-22 06:43:04

标签: r

我需要查看ExtractLambdas函数的源代码,该函数在 mirt 包内部使用。

我试过以下事情: 1)

showMethods("ExtraLambdas")

Function "ExtraLambdas":
 <not an S4 generic function>

2)

getAnywhere(ExtractLambdas)
A single object matching ‘ExtractLambdas’ was found
It was found in the following places
  namespace:mirt
with value

function (x) 
standardGeneric("ExtractLambdas")
<bytecode: 0x0000000044248898>
<environment: 0x000000005a3a3750>
attr(,"generic")
[1] "ExtractLambdas"
attr(,"generic")attr(,"package")
[1] "mirt"
attr(,"package")
[1] "mirt"
attr(,"group")
list()
attr(,"valueClass")
character(0)
attr(,"signature")
[1] "x"
attr(,"default")
`\001NULL\001`
attr(,"skeleton")
(function (x) 
stop("invalid call in method dispatch to 'ExtractLambdas' (no default method)", 
    domain = NA))(x)
attr(,"class")
[1] "standardGeneric"
attr(,"class")attr(,"package")
[1] "methods"

仍然无法获取ExtraLambdas的代码。请帮忙。 提前谢谢。

1 个答案:

答案 0 :(得分:4)

使用:::

library(mirt)
showMethods(mirt:::ExtractLambdas)
# Function: ExtractLambdas (package mirt)
# x="custom"
# x="dich"
# x="gpcm"
# x="graded"
# x="ideal"
# x="nestlogit"
# x="nominal"
# x="partcomp"
# x="rating"
# x="rsm"

selectMethod(mirt:::ExtractLambdas, "nominal")
# Method Definition:
#   
#   function (x) 
#   {
#     x@par[1L:x@nfact]
#   }
# <bytecode: 0x000000002bd90f78>
#   <environment: namespace:mirt>
#   
#   Signatures:
#   x        
# target  "nominal"
# defined "nominal"