Skip to contents

Compiles all top-level expressions in an R source file to bytecode and saves the result to an output file.

Usage

cmpfile(infile, outfile, ascii = FALSE, env = .GlobalEnv,
        verbose = FALSE, options = NULL, version = NULL)

Arguments

infile

Path to the input R source file.

outfile

Path to the output file. If missing, defaults to the input file name with extension replaced by .Rc.

ascii

Logical; whether to write an ASCII file.

env

The top-level environment in which to evaluate expressions.

verbose

Logical; if TRUE, print the progress of the compilation.

options

List of compilation options.

version

Optional file format version.

Value

Invisible NULL. Output is written to file as a side effect.

Examples

tmp_r <- tempfile(fileext = ".R")
tmp_rc <- tempfile(fileext = ".Rc")
writeLines("x <- 1; x + 1", tmp_r)
cmpfile(tmp_r, tmp_rc)
#> saving to file "/tmp/RtmpMmDEdi/file194365c3ebcd.Rc" ... done