include {envir} | R Documentation |
Source R files
Description
Source R files
Usage
include(
files_andor_dirs,
envir = parent.frame(),
chdir = FALSE,
recursive = FALSE
)
Arguments
files_andor_dirs |
A character vector of filepaths to R files, or
directories containing R files. Directories are searched for files that end
with extension ".R" or ".r", ignoring those that start with a period ( |
envir |
An R environment. By default, the current R evaluation environment. |
chdir |
logical; if |
recursive |
whether to search directories recursively for R files. |
Details
This is a vectorized wrapper around base::sys.source
with some
differences. Notably:
-
envir
defaults to the current frame -
envir
is returned (invisibly) -
keep.source
andkeep.parse.data
default togetOption("keep.source")
andgetOption("keep.parse.data")
respectively, instead ofgetOption("keep.source.pkgs")
andgetOption("keep.parse.data.pkgs")
-
toplevel.env
is set togetOption("topLevelEnvironment", envir)
. In other words, if the optiontopLevelEnvironment
is already set, it is respected.
Value
The environment envir
, invisibly.