The R Project SVN R

Rev

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

Rev 27508 Rev 27930
Line 22... Line 22...
22
}
22
}
23
\details{
23
\details{
24
  The namespace can be specified in several ways.  Using, for example,
24
  The namespace can be specified in several ways.  Using, for example,
25
  \code{ns = "stats"} is the most direct, but a loaded package with a
25
  \code{ns = "stats"} is the most direct, but a loaded package with a
26
  namespace can be specified via any of the methods used for
26
  namespace can be specified via any of the methods used for
27
  \code{\link{get}}: \code{ns} can also be the environment
27
  \code{\link{get}}: \code{ns} can also be the environment printed as
28
  \code{<namespace:foo>}.
28
  \code{<namespace:foo>}.
29
 
29
 
-
 
30
  \code{getFromNamespace} is similar to (but predates) the
-
 
31
  \code{\link{:::}} operator, but is more flexible in how the namespace
-
 
32
  is specified.
-
 
33
  
30
  \code{fixInNamespace} invokes \code{\link{edit}} on the object named
34
  \code{fixInNamespace} invokes \code{\link{edit}} on the object named
31
  \code{x} and assigns the revised object in place of the original
35
  \code{x} and assigns the revised object in place of the original
32
  object.  For compatibility with \code{fix}, \code{x} can be unquoted.
36
  object.  For compatibility with \code{fix}, \code{x} can be unquoted.
33
}
37
}
34
\note{
38
\note{
35
  \code{fixInNamespace} will alter the copy of the object in the
-
 
36
  namespace, and also a copy registered as an S3 method.  There can be other
-
 
37
  copies, so the function is not foolproof, but should be helpful for
-
 
38
  debugging.
-
 
39
 
-
 
40
  \code{assignInNamespace} and \code{fixInNamespace} change the copy in
39
  \code{assignInNamespace} and \code{fixInNamespace} change the copy in
41
  the namespace, but not that exported from the namespace, if there is one.
40
  the namespace, but not any copies already exported from the namespace,
-
 
41
  in particular an object of that name in the package (if already
-
 
42
  attached) and any copies already imported into other namespaces.
-
 
43
  They are really intended to be used \emph{only} for objects which are
-
 
44
  not exported from the namespace.  They do attempt to alter a copy
-
 
45
  registered as an S3 method if one is found.
42
}
46
}
43
\value{
47
\value{
44
  \code{getFromNamespace} returns the object found (or gives an error).
48
  \code{getFromNamespace} returns the object found (or gives an error).
45
 
49
 
46
  \code{assignInNamespace} and \code{fixInNamespace} are invoked for
50
  \code{assignInNamespace} and \code{fixInNamespace} are invoked for
Line 48... Line 52...
48
}
52
}
49
 
53
 
50
\seealso{
54
\seealso{
51
  \code{\link{get}}, \code{\link{fix}}, \code{\link{getS3method}}
55
  \code{\link{get}}, \code{\link{fix}}, \code{\link{getS3method}}
52
}
56
}
53
\examples{\dontrun{
57
\examples{
-
 
58
getFromNamespace("findGeneric", "utils")
-
 
59
\dontrun{
54
fixInNamespace("predict.ppr", "stats")
60
fixInNamespace("predict.ppr", "stats")
-
 
61
stats:::predict.ppr
-
 
62
getS3method("predict", "ppr")
55
## alternatively
63
## alternatively
56
fixInNamespace("predict.ppr", pos = 5)
64
fixInNamespace("predict.ppr", pos = 3)
-
 
65
fixInNamespace("predict.ppr", pos = "package:stats")
57
}}
66
}}
58
\keyword{data}
67
\keyword{data}