user3755708
user3755708

Reputation:

Source code for a function which is not an s4 generic

I need to see the source code for the ExtractLambdas function which is used internally in mirt package.

I have tried following things: 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"

Still I am unable to get the code for ExtraLambdas. Please help. thanks in advance.

Upvotes: 2

Views: 2156

Answers (1)

Roland
Roland

Reputation: 132706

Use ::::

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"

Upvotes: 5

Related Questions