[R] Where to find the source codes for the internal function in stats package
Gabor Grothendieck
ggrothendieck at gmail.com
Sat Jan 17 23:57:03 CET 2009
Look for do_modelmatrix here:
https://svn.r-project.org/R/trunk/src/main/model.c
On Sat, Jan 17, 2009 at 5:40 PM, Murray Cooper <myrmail at earthlink.net> wrote:
> Dear Dr Murdoch,
>
> I understand in principle your explanation, but specifically where in the
> source distribution are these functions found? For instance, I would like
> to look at the code for model.matrix. Ex:
> ans <- .Internal(model.matrix(t, data))
>
> I have looked at the source distribution but been unable to locate the
> file which contains model.matrix.
>
> Thanks for your help.
>
> Murray Cooper
>
> ----- Original Message ----- From: "Duncan Murdoch" <murdoch at stats.uwo.ca>
> To: "zhijie zhang" <rusers.sh at gmail.com>
> Cc: <r-help at stat.math.ethz.ch>
> Sent: Saturday, January 17, 2009 6:00 AM
> Subject: Re: [R] Where to find the source codes for the internal function in
> stats package
>
>
>> On 17/01/2009 2:23 AM, zhijie zhang wrote:
>>>
>>> Dear all,
>>> I want to see the source codes for "dchisq(x, df, ncp=0, log = FALSE)",
>>> but cannot find it.
>>> I input "dchisq" in the R interface, and then enter, the following
>>> message
>>> return:
>>>>
>>>> dchisq
>>>
>>> /*****************************************************/
>>> function (x, df, ncp = 0, log = FALSE)
>>> {
>>> if (missing(ncp))
>>> .Internal(dchisq(x, df, log))
>>> else .Internal(dnchisq(x, df, ncp, log))
>>> }
>>> <environment: namespace:stats>
>>> /*****************************************************/
>>> It seems that dchisq() is the internal function in STATS package. So go
>>> to "C:\Program Files\R\R-2.7.2\library\stats" to look for it. I browsed
>>> the
>>> files in this catalog, but it seems that i missed it.
>>> Anybody can tell me how and where to find the codes, Thanks a lot.
>>
>> Uwe Ligges wrote a nice article on finding source in R News :
>>
>> Ligges, U. (2006): R Help Desk: Accessing the Sources. R News 6 (4),
>> 43-45. http://cran.r-project.org/doc/Rnews/
>>
>> As it explains, .Internal() calls functions in the main R binary, not in a
>> package DLL.
>>
>> Duncan Murdoch
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list