The R Project SVN R

Rev

Rev 25816 | Rev 37018 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
15430 jmc 1
\name{methodUtilities}
2
\alias{functionBody}
15822 jmc 3
\alias{functionBody<-}
15430 jmc 4
\alias{allNames}
5
\alias{getFunction}
26093 jmc 6
\alias{existsFunction}
15430 jmc 7
\alias{el}
8
\alias{elNamed}
15822 jmc 9
\alias{el<-}
10
\alias{elNamed<-}
15430 jmc 11
\alias{formalArgs}
12
\alias{Quote}
13
\alias{message}
17454 jmc 14
\alias{showDefault}
21102 jmc 15
\alias{initMethodDispatch}
15430 jmc 16
\title{Utility Functions for Methods and S-Plus Compatibility}
19029 hornik 17
\description{
25118 hornik 18
  These are utilities, currently in the \pkg{methods} package, that
19
  either provide some functionality needed by the package (e.g., element
19029 hornik 20
  matching by name), or add compatibility with S-Plus, or both.
21
}
15430 jmc 22
\usage{
23
functionBody(fun=sys.function(sys.parent()))
24
 
25
allNames(x)
26
 
15514 ripley 27
getFunction(name, generic=TRUE, mustFind=TRUE, where)
15430 jmc 28
 
29
el(object, where)
30
 
15514 ripley 31
elNamed(x, name, mustFind=FALSE)
15430 jmc 32
 
33
formalArgs(def)
34
 
35
Quote()
36
 
37
message(...)
17454 jmc 38
 
20092 jmc 39
showDefault(object, oldMethods = TRUE)
21102 jmc 40
 
41
initMethodDispatch()
15430 jmc 42
}
17211 jmc 43
\section{Summary of Functions}{
19029 hornik 44
  \describe{
45
    \item{\code{allNames}:}{ 
46
      the character vector of names (unlike \code{names()}, never
47
      returns \code{NULL}).
48
    }
49
    \item{\code{getFunction}:}{ 
50
      find the object as a function.
51
    }
15430 jmc 52
 
19029 hornik 53
    \item{\code{elNamed}:}{ 
54
      get the element of the vector corresponding to name.  Unlike the
25816 jmc 55
      \code{[}, \code{[[}, and \code{$} operators, this function %$
19029 hornik 56
      requires \code{name} to match the element name exactly (no partial
57
      matching).
58
    }
59
    \item{\code{formalArgs}:}{ 
60
      Returns the names of the formal arguments of this function.
61
    }
15430 jmc 62
 
19029 hornik 63
    \item{\code{existsFunction}:}{ 
64
      Is there a function of this name?  If \code{generic} is
65
      \code{FALSE}, generic functions are not counted. 
66
    }
15430 jmc 67
 
19029 hornik 68
    \item{\code{findFunction}:}{ 
69
      return all the indices of the search list on which a function
70
      definition for \code{name} exists.  
15430 jmc 71
 
19029 hornik 72
      If \code{generic} is \code{FALSE}, ignore generic functions.
73
    }
74
    \item{\code{message}:}{ 
75
      Output all the arguments, pasted together with no intervening
76
      spaces.
77
    }
78
    \item{\code{showDefault}:}{ 
79
      Utility, used to enable \code{show} methods to be called by the
80
      automatic printing (via \code{print.default}).
25816 jmc 81
 
82
  { Argument \code{oldMethods} controls whether old-style print
83
    methods are used for this
84
    object.  It is  \code{TRUE} by default if called directly, but \code{FALSE}
85
    when called from the \pkg{methods} package for automatic printing (to
86
    avoid potential recursion).
19029 hornik 87
    }
21142 ripley 88
    \item{\code{initMethodDispatch}:}{
21102 jmc 89
        Turn on the internal method dispatch code.  Called on
90
        attaching the package.  Also, if dispatch has been turned off
91
        (by calling \code{.isMethodsDispatchOn(FALSE)}---a very gutsy
92
        thing to do), calling this function should turn dispatch back
93
        on again.
21142 ripley 94
      }
95
    }
15430 jmc 96
  }
97
}
16802 jmc 98
\keyword{internal}