[R] Source code of rnorm, where can I find it?
Waclaw Kusnierczyk
waku at idi.ntnu.no
Wed Feb 2 21:22:29 CET 2011
On 02/02/2011 01:50 PM, Ista Zahn wrote:
>
> .Internal functions such as rnorm cannot be retrieved in this way as
> far as I know. You may have to download the source and find it
> direclty.
In this particular case you can find the implementation of rnorm with
grep -rn --include=*.c '"rnorm"' .
# ./src/main/names.c:449:{"rnorm", do_random2, ...
grep -rn --include=*.c 'do_random2(' .
# ./src/main/random.c:131:SEXP attribute_hidden do_random2(SEXP
call, SEXP op, SEXP args, SEXP rho)
Starting with line 131 in src/main/random.c you can follow the chain of
macro executions and calls to see how rnorm is actually implemented.
vQ
More information about the R-help
mailing list