| Line 1... |
Line 1... |
| 1 |
% File src/library/base/man/pos.to.env.Rd
|
1 |
% File src/library/base/man/pos.to.env.Rd
|
| 2 |
% Part of the R package, http://www.R-project.org
|
2 |
% Part of the R package, http://www.R-project.org
|
| 3 |
% Copyright 1995-2007 R Core Team
|
3 |
% Copyright 1995-2012 R Core Team
|
| 4 |
% Distributed under GPL 2 or later
|
4 |
% Distributed under GPL 2 or later
|
| 5 |
|
5 |
|
| 6 |
\name{pos.to.env}
|
6 |
\name{pos.to.env}
|
| 7 |
\alias{pos.to.env}
|
7 |
\alias{pos.to.env}
|
| 8 |
\title{Convert Positions in the Search Path to Environments}
|
8 |
\title{Convert Positions in the Search Path to Environments}
|
| 9 |
\description{
|
9 |
\description{
|
| 10 |
Returns the environment at a specified position in the search path.
|
10 |
Returns the environment at a specified position in the search path.
|
| 11 |
}
|
11 |
}
|
| 12 |
\usage{pos.to.env(x)}
|
12 |
\usage{pos.to.env(x)}
|
| 13 |
\arguments{
|
13 |
\arguments{
|
| 14 |
\item{x}{an integer between 1 and \code{length(search())}, the length
|
14 |
\item{x}{an integer between \code{1} and \code{length(search())}, the length
|
| 15 |
of the search path.}
|
15 |
of the search path, or \code{-1}.}
|
| 16 |
}
|
16 |
}
|
| 17 |
\details{
|
17 |
\details{
|
| 18 |
Several \R functions for manipulating objects in environments (such as
|
18 |
Several \R functions for manipulating objects in environments (such as
|
| 19 |
\code{\link{get}} and \code{\link{ls}}) allow specifying environments
|
19 |
\code{\link{get}} and \code{\link{ls}}) allow specifying environments
|
| 20 |
via corresponding positions in the search path. \code{pos.to.env} is
|
20 |
via corresponding positions in the search path. \code{pos.to.env} is
|
| 21 |
a convenience function for programmers which converts these positions
|
21 |
a convenience function for programmers which converts these positions
|
| 22 |
to corresponding environments; users will typically have no need for
|
22 |
to corresponding environments; users will typically have no need for
|
| 23 |
it. It is \link{primitive}.
|
23 |
it. It is \link{primitive}.
|
| - |
|
24 |
|
| - |
|
25 |
\code{-1} is interpreted as the environment the function is called
|
| - |
|
26 |
from.
|
| - |
|
27 |
|
| - |
|
28 |
This is a \link{primitive} function.
|
| 24 |
}
|
29 |
}
|
| 25 |
\examples{
|
30 |
\examples{
|
| 26 |
pos.to.env(1) # R_GlobalEnv
|
31 |
pos.to.env(1) # R_GlobalEnv
|
| 27 |
# the next returns the base environment
|
32 |
# the next returns the base environment
|
| 28 |
pos.to.env(length(search()))
|
33 |
pos.to.env(length(search()))
|