| Line 1... |
Line 1... |
| 1 |
% File src/library/base/man/sys.source.Rd
|
1 |
% File src/library/base/man/sys.source.Rd
|
| 2 |
% Part of the R package, https://www.R-project.org
|
2 |
% Part of the R package, https://www.R-project.org
|
| 3 |
% Copyright 1995-2007 R Core Team
|
3 |
% Copyright 1995-2018 R Core Team
|
| 4 |
% Distributed under GPL 2 or later
|
4 |
% Distributed under GPL 2 or later
|
| 5 |
|
5 |
|
| 6 |
\name{sys.source}
|
6 |
\name{sys.source}
|
| 7 |
\alias{sys.source}
|
7 |
\alias{sys.source}
|
| 8 |
\title{Parse and Evaluate Expressions from a File}
|
8 |
\title{Parse and Evaluate Expressions from a File}
|
| Line 11... |
Line 11... |
| 11 |
them in the specified environment.
|
11 |
them in the specified environment.
|
| 12 |
}
|
12 |
}
|
| 13 |
\usage{
|
13 |
\usage{
|
| 14 |
sys.source(file, envir = baseenv(), chdir = FALSE,
|
14 |
sys.source(file, envir = baseenv(), chdir = FALSE,
|
| 15 |
keep.source = getOption("keep.source.pkgs"),
|
15 |
keep.source = getOption("keep.source.pkgs"),
|
| - |
|
16 |
keep.parse.data = getOption("keep.parse.data.pkgs"),
|
| 16 |
toplevel.env = as.environment(envir))
|
17 |
toplevel.env = as.environment(envir))
|
| 17 |
}
|
18 |
}
|
| 18 |
\arguments{
|
19 |
\arguments{
|
| 19 |
\item{file}{a character string naming the file to be read from}
|
20 |
\item{file}{a character string naming the file to be read from}
|
| 20 |
\item{envir}{an \R object specifying the environment in which the
|
21 |
\item{envir}{an \R object specifying the environment in which the
|
| Line 25... |
Line 26... |
| 25 |
\item{chdir}{logical; if \code{TRUE}, the \R working directory is
|
26 |
\item{chdir}{logical; if \code{TRUE}, the \R working directory is
|
| 26 |
changed to the directory containing \code{file} for evaluating.}
|
27 |
changed to the directory containing \code{file} for evaluating.}
|
| 27 |
\item{keep.source}{logical. If \code{TRUE}, functions keep
|
28 |
\item{keep.source}{logical. If \code{TRUE}, functions keep
|
| 28 |
their source including comments, see
|
29 |
their source including comments, see
|
| 29 |
\code{\link{options}(keep.source = *)} for more details.}
|
30 |
\code{\link{options}(keep.source = *)} for more details.}
|
| - |
|
31 |
\item{keep.parse.data}{logical. If \code{TRUE} and \code{keep.source} is
|
| - |
|
32 |
also \code{TRUE}, functions keep parse data with their source, see
|
| - |
|
33 |
\code{\link{options}(keep.parse.data = *)} for more details.}
|
| 30 |
\item{toplevel.env}{an \R environment to be used as top level while
|
34 |
\item{toplevel.env}{an \R environment to be used as top level while
|
| 31 |
evaluating the expressions. This argument is useful for frameworks
|
35 |
evaluating the expressions. This argument is useful for frameworks
|
| 32 |
running package tests; the default should be used in other cases}
|
36 |
running package tests; the default should be used in other cases}
|
| 33 |
}
|
37 |
}
|
| 34 |
\details{
|
38 |
\details{
|
| 35 |
For large files, \code{keep.source = FALSE} may save quite a bit of
|
39 |
For large files, \code{keep.source = FALSE} may save quite a bit of
|
| - |
|
40 |
memory. Disabling only parse data via \code{keep.parse.data = FALSE}
|
| 36 |
memory.
|
41 |
can already save a lot.
|
| 37 |
%%FIXME: the following paragraph should be somewhere it's likely to be seen
|
42 |
%%FIXME: the following paragraph should be somewhere it's likely to be seen
|
| 38 |
In order for the code being evaluated to use the correct environment
|
43 |
In order for the code being evaluated to use the correct environment
|
| 39 |
(for example, in global assignments), source code in packages should
|
44 |
(for example, in global assignments), source code in packages should
|
| 40 |
call \code{\link{topenv}()}, which will return the namespace, if any,
|
45 |
call \code{\link{topenv}()}, which will return the namespace, if any,
|
| 41 |
the environment set up by \code{sys.source}, or the global environment
|
46 |
the environment set up by \code{sys.source}, or the global environment
|