R .Internal for Beginners
I am new to R and I ran into a piece of code that I do not understand. More specifically, I would like to know what .Internal
does. Here is an example that I am trying to convert to Matlab:
dunif <- function (x, min = 0, max = 1, log = FALSE)
.Internal(dunif(x, min, max, log))
<environment: namespace:stats>
开发者_JAVA技巧
I would like to know what .Internal
and <environment ... >
do.
Thank you much in advance, Simon
From ?.Internal
:
‘.Internal’ performs a call to an internal code which is built in
to the R interpreter.
You'll find the code for dunif
in the R sources. I find this type of function via a grep for it in main/names.c
then grep for the name it refers to (do_math3
in this case), which you will find in main/arithmetic.c
.
<environment: namespace:stats>
simply tells you the location / namespace of the function.
I found R in a Nutshell a useful resource to explain objects and environments in a non-intimidating way. It is worth a look.
精彩评论