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 (.) or an underscore (⁠_⁠). The found files files from each directory are sorted by their basename() before being sourced. Filepaths can be supplied explicitly to override the default sorting.

envir

An R environment. By default, the current R evaluation environment.

chdir

logical; if TRUE, the R working directory is changed to the directory containing file for evaluating.

recursive

whether to search directories recursively for R files.

Details

This is a vectorized wrapper around base::sys.source with some differences. Notably:

Value

The environment envir, invisibly.


[Package envir version 0.3.0 Index]