[R] Viewing source code for .Internal functions

Duncan Murdoch murdoch at stats.uwo.ca
Tue Jan 15 15:58:47 CET 2008


On 1/15/2008 9:37 AM, Sarah Touati wrote:
> I am trying to view the source code of the function nlm in the stats 
> package of R 2.4.1.
> 
> I downloaded the source from CRAN and opened nlm.R, and it calls a 
> .Internal function:
> 
> .Internal(nlm(function(x) f(x, ...), p, hessian, typsize, fscale,
>                   msg, ndigit, gradtol, stepmax, steptol, iterlim))
> 
> This is the same thing I saw when entering the function name at the R 
> command prompt. Where will I find the actual code?

Uwe Ligges wrote about this in R-news, in this issue:

http://cran.r-project.org/doc/Rnews/Rnews_2006-4.pdf, page 43.

You need to find the C code corresponding to nlm.  That is the do_nlm 
routine in src/main/optimize.c, but naturally enough, it calls a lot of 
lower level routines.

Duncan Murdoch




More information about the R-help mailing list