Reputation: 13675
See the following. I don't understand what the purpose of .Internal is. Its documentation is not clear. Could anybody help me understand when .Internal
is required and why it is needed?
R> f=file('f.R', 'r')
R> .Internal(parse(f, n = -1, NULL, '?', 'f.R', encoding='unknown'))
expression(f = function(x) {
x
})
R> f=file('f.R', 'r')
R> parse(f, n = -1, NULL, '?', 'f.R', encoding='unknown')
expression(f = function(x) {
x
})
To learn this better, I want to extract the C code from R base and compile it separately, then call .Internal on the compiled binary. Is there a way to do it?
Upvotes: 0
Views: 310
Reputation: 44867
.Internal()
is one of the interfaces to functions written in C within R. The other one is displayed as .Primitive()
. You can read about the differences in Chapter 2 of the "R Internals" manual.
You shouldn't call .Internal()
directly. It's there so that the R developers can write functions like parse()
that do some things in R and some things in C. If you want to do that, you should be using .C()
, .Call()
, or .External()
. (There's also .Fortran()
with a Fortran interface.) These are described in the "Writing R Extensions" manual.
Upvotes: 3