Primitive Look Up a Primitive Function.Primitive looks up by name a ‘primitive’ (internally implemented) function.
.Primitive(name)
name | name of the R function. |
The advantage of .Primitive over .Internal functions is the potential efficiency of argument passing, and that positional matching can be used where desirable, e.g. in switch. For more details, see the ‘R Internals’ manual.
All primitive functions are in the base namespace.
This function is almost never used: `name` or, more carefully, get(name, envir = baseenv()) work equally well and do not depend on knowing which functions are primitive (which does change as R evolves).
is.primitive showing that primitive functions come in two types (typeof), .Internal.
mysqrt <- .Primitive("sqrt")
c
.Internal # this one *must* be primitive!
`if` # need backticks
Copyright (©) 1999–2012 R Foundation for Statistical Computing.
Licensed under the GNU General Public License.