sys.source {base} | R Documentation

## Parse and Evaluate Expressions from a File

### Description

Parses expressions in the given file, and then successively evaluates them in the specified environment. By default, evaluation is done in the user's workspace (the global environment).

### Usage

    sys.source(file, envir = NULL, chdir = FALSE,
               keep.source = getOption("keep.source"))

### Arguments

`file` | a character string naming the file to be read from
`envir` | an R object specifying the environment in which the expressions are to be evaluated. May also be a list or an integer.
`chdir` | logical; if `TRUE`, the R working directory is changed to the directory containing `file` for evaluating.
`keep.source` | logical. If `TRUE`, functions ``keep their source'' including comments, see `options(keep.source = *)` for more details.

### Details

For large files, `keep.source = FALSE` may save quite a bit of memory.

### See Also

`source`, and `library` which uses `sys.source`.