The R Project SVN R

Rev

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

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