Primitive

0th

Percentile

Look Up a Primitive Function

.Primitive looks up by name a ‘primitive’ (internally implemented) function.

Keywords
interface
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, 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).

Note

Prior to R 2.14.2 this could also be used to retrieve .Internal functions: this was unintentional.

See Also

.Internal.

Aliases
  • .Primitive
  • primitive
Examples
library(base) mysqrt <- .Primitive("sqrt") c .Internal # this one *must* be primitive! `if` # need backticks
Documentation reproduced from package base, version 3.0.3, License: Part of R 3.0.3

Community examples

Looks like there are no examples yet.