The R Project SVN R

Rev

Rev 61433 | Rev 73574 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 61433 Rev 61678
Line 1... Line 1...
1
% File src/library/utils/man/getFromNamespace.Rd
1
% File src/library/utils/man/getFromNamespace.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-2011 R Core Team
3
% Copyright 1995-2013 R Core Team
4
% Distributed under GPL 2 or later
4
% Distributed under GPL 2 or later
5
 
5
 
6
\name{getFromNamespace}
6
\name{getFromNamespace}
7
\alias{assignInNamespace}
7
\alias{assignInNamespace}
8
\alias{assignInMyNamespace}
8
\alias{assignInMyNamespace}
Line 11... Line 11...
11
\title{Utility functions for Developing Namespaces}
11
\title{Utility functions for Developing Namespaces}
12
\description{
12
\description{
13
  Utility functions to access and replace the non-exported functions in
13
  Utility functions to access and replace the non-exported functions in
14
  a namespace, for use in developing packages with namespaces.
14
  a namespace, for use in developing packages with namespaces.
15
 
15
 
16
  They should not be used in production code.
16
  They should not be used in production code (except perhaps
-
 
17
  \code{assignInMyNamespace}, but see the \sQuote{Note}).
17
}
18
}
18
\usage{
19
\usage{
19
getFromNamespace(x, ns, pos = -1, envir = as.environment(pos))
20
getFromNamespace(x, ns, pos = -1, envir = as.environment(pos))
20
 
21
 
21
assignInNamespace(x, value, ns, pos = -1,
22
assignInNamespace(x, value, ns, pos = -1,
Line 37... Line 38...
37
  \code{assignInMyNamespace} is intended to be called from functions
38
  \code{assignInMyNamespace} is intended to be called from functions
38
  within a package, and chooses the namespace as the environment of the
39
  within a package, and chooses the namespace as the environment of the
39
  function calling it.
40
  function calling it.
40
 
41
 
41
  The namespace can be specified in several ways.  Using, for example,
42
  The namespace can be specified in several ways.  Using, for example,
42
  \code{ns = "stats"} is the most direct, but a loaded package with a
43
  \code{ns = "stats"} is the most direct, but a loaded package can be
43
  namespace can be specified via any of the methods used for
44
  specified via any of the methods used for \code{\link{get}}: \code{ns}
44
  \code{\link{get}}: \code{ns} can also be the environment printed as
45
  can also be the environment printed as \code{<namespace:foo>}.
45
  \code{<namespace:foo>}.
-
 
46
 
46
 
47
  \code{getFromNamespace} is similar to (but predates) the
47
  \code{getFromNamespace} is similar to (but predates) the
48
  \code{\link{:::}} operator, but is more flexible in how the namespace
48
  \code{\link{:::}} operator: it is more flexible in how the namespace
49
  is specified.
49
  is specified.
50
 
50
 
51
  \code{fixInNamespace} invokes \code{\link{edit}} on the object named
51
  \code{fixInNamespace} invokes \code{\link{edit}} on the object named
52
  \code{x} and assigns the revised object in place of the original
52
  \code{x} and assigns the revised object in place of the original
53
  object.  For compatibility with \code{fix}, \code{x} can be unquoted.
53
  object.  For compatibility with \code{fix}, \code{x} can be unquoted.
Line 56... Line 56...
56
  \code{assignInNamespace} should not be used in final code, and will in
56
  \code{assignInNamespace} should not be used in final code, and will in
57
  future throw an error if called from a package.  Already certain uses
57
  future throw an error if called from a package.  Already certain uses
58
  are disallowed.
58
  are disallowed.
59
}
59
}
60
\note{
60
\note{
61
  \code{assignInNamespace} and \code{fixInNamespace} change the copy in
61
  \code{assignInNamespace}, \code{assignInMyNamespace} and
62
  the namespace, but not any copies already exported from the namespace,
62
  \code{fixInNamespace} change the copy in the namespace, but not any
63
  in particular an object of that name in the package (if already
63
  copies already exported from the namespace, in particular an object of
64
  attached) and any copies already imported into other namespaces.
64
  that name in the package (if already attached) and any copies already
65
  They are really intended to be used \emph{only} for objects which are
65
  imported into other namespaces.  They are really intended to be used
66
  not exported from the namespace.  They do attempt to alter a copy
66
  \emph{only} for objects which are not exported from the namespace.
67
  registered as an S3 method if one is found.
67
  They do attempt to alter a copy registered as an S3 method if one is
-
 
68
  found.
68
 
69
 
69
  They can only be used to change the values of objects in the
70
  They can only be used to change the values of objects in the
70
  namespace, not to create new objects.
71
  namespace, not to create new objects.
71
}
72
}
72
\value{
73
\value{