Primitive {base} | R Documentation |
Call a “Primitive” Internal Function
Description
.Primitive
returns an entry point to a ‘primitive’
(internally implemented) function.
Usage
.Primitive(name)
Arguments
name |
name of the R function. |
Details
The advantage of .Primitive
over .Internal
functions is the potential efficiency of argument passing. However,
this is done by ignoring argument names and using positional matching
of arguments (unless arranged differently for specific primitives such
as rep
), so this is discouraged for functions of more
than one argument.
All primitive functions are in the base name space.
See Also
.Internal
.
Examples
mysqrt <- .Primitive("sqrt")
c
.Internal # this one *must* be primitive!
get("if") # just 'if' or 'print(if)' are not syntactically ok.