Skip to contents

Compiles an R closure to bytecode using the C-based compiler backend.

Usage

cmpfun(f, options = NULL)

Arguments

f

A closure to compile to bytecode. If f is a builtin or special function, cmpfun returns it without a change.

options

A named list of compilation options. If options is NULL, cmpfun uses the default options. As in compiler::cmpfun, options can also be a different object with names, for example a named vector.

Value

A bytecode-compiled function.

Examples

f <- function(x) x + 1
cf <- cmpfun(f)
cf(10)
#> [1] 11