2

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.

  • Check [here](http://stackoverflow.com/questions/19226816/how-can-i-view-the-source-code-for-a-function) – David Arenburg Aug 22 '14 at 07:06
  • @DavidArenburg, thank you for your reply. But I tried that link; its not helping me. showMethods(ExtractLambdas) Error in is(f, "function") : object 'ExtractLambdas' not found ExtractLambdas is internal function. mirt:::ExtractLambdas standardGeneric for "ExtractLambdas" defined from package "mirt" function (x) standardGeneric("ExtractLambdas") Methods may be defined for arguments: x Use showMethods("ExtractLambdas") for currently available ones. Does this help you to solve my problem? –  Aug 22 '14 at 07:15
  • 1
    If its a package on CRAN then download the source code archive file and extract it on your machine. Then instead of just having it whizz past your console you can open it with your favourite text editor, search it, etc etc. – Spacedman Aug 22 '14 at 07:31

1 Answers1

5

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"
Roland
  • 127,288
  • 10
  • 191
  • 288