[R] How to look within .Internal ?

Duncan Murdoch murdoch at stats.uwo.ca
Wed Nov 19 16:27:38 CET 2008


On 11/19/2008 10:13 AM, megh wrote:
> In the optim() function there is a syntax :
> 
> res <- .Internal(optim(par, fn1, gr1, method, con, lower, 
> 
> Here how can I see the inside-codes of ".Internal" function ?


You need the R source code.  Then find src/main/names.c, and look up 
"optim".  It will tell you the C name of the function being called.

In this case, for the R-devel version, you'll find this on names.c line 853:

{"optim",	do_optim,	0,	11,	7,	{PP_FUNCALL, PREC_FN,	0}},

So you need to find the do_optim function.  It's in src/main/optim.c.

You can browse these source files on

https://svn.r-project.org/R/trunk/src/main

Duncan Murdoch



More information about the R-help mailing list