loadCode: Load R code from a directory

View source: R/readPkg.R

loadCodeR Documentation

Load R code from a directory

Description

source() code from a directory. This actually evaluates the code. Often we want to analyze it statically, i.e., without running the code. This function is useful if the code is mostly function definitions. But for that, we can now use getFunctionDefs in CodeDepends.

Usage

loadCode(dir, env = new.env(), files = list.files(dir, pattern = "\\.[RrsSqQ]$", full.names = TRUE))

Arguments

dir

the directory in which to find the R code files

env

the environment into which to source the code.

files

the full paths to the files whose code we read. This allows the caller to provide a subset of the files and also to control the order in which the files are source'd.

Details

This sources the code into the given environment.

Value

This returns the environment env which will contain the variables defined in the sour

Author(s)

Duncan Temple Lang

See Also

getFunctionDefs


duncantl/CodeAnalysis documentation built on April 28, 2024, 6:01 p.m.