The R Project SVN R

Rev

Rev 84767 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
42333 ripley 1
% File src/library/base/man/zMethods.Rd
68948 ripley 2
% Part of the R package, https://www.R-project.org
89535 smeyer 3
% Copyright 1995-2026 R Core Team
42333 ripley 4
% Distributed under GPL 2 or later
5
 
23610 ripley 6
\name{InternalMethods}
84765 maechler 7
\title{Internal Generic Functions}
56186 murdoch 8
\alias{InternalMethods}
39493 ripley 9
\alias{InternalGenerics}
10
\alias{internal generic}
40456 ripley 11
\alias{.S3PrimitiveGenerics}
84765 maechler 12
\alias{.internalGenerics}
23613 ripley 13
\description{
14
  Many \R-internal functions are \emph{generic} and allow
23610 ripley 15
  methods to be written for.
23291 hornik 16
}
3986 ripley 17
 
23291 hornik 18
  % -------------------- grep -nw DispatchOrEval src/*/*[ch]
19
  %                         --------------
49649 ripley 20
\details{
38997 ripley 21
  The following primitive and internal functions are \emph{generic},
22
  i.e., you can write \code{\link{methods}} for them:
3986 ripley 23
 
77888 hornik 24
  % DispatchOrEval internal generic: [
40176 ripley 25
  \code{\link{[}},%            % do_subset()         [subset.c]
77888 hornik 26
  % DispatchOrEval internal generic: [[
40176 ripley 27
  \code{\link{[[}},%           % do_subset2()        [subset.c]
77888 hornik 28
  % DispatchOrEval internal generic: $
23358 ripley 29
  \code{\link{$}},
77888 hornik 30
  % DispatchOrEval internal generic: [<-
23358 ripley 31
  \code{\link{[<-}},
77888 hornik 32
  % DispatchOrEval internal generic: [[<-
23358 ripley 33
  \code{\link{[[<-}},
77888 hornik 34
  % DispatchOrEval internal generic: $<-
23358 ripley 35
  \code{\link{$<-}},
36
 
77888 hornik 37
  % DispatchOrEval internal generic: length
40176 ripley 38
  \code{\link{length}},%      % do_length()          [array.c]
77888 hornik 39
  % DispatchOrEval internal generic: length<-
40176 ripley 40
  \code{\link{length<-}},%    % do_lengthgets()      [builtin.c]
77896 hornik 41
  % DispatchOrEval internal generic: lengths
42
  \code{\link{lengths}},%     % do_lengths()         [array.c]
77888 hornik 43
  % DispatchOrEval internal generic: dimnames
40176 ripley 44
  \code{\link{dimnames}},%    % do_dimnames()        [attrib.c]
77888 hornik 45
  % DispatchOrEval internal generic: dimnames<-
40176 ripley 46
  \code{\link{dimnames<-}},%  % do_dimnamesgets()    [attrib.c]
77888 hornik 47
  % DispatchOrEval internal generic: dim
40176 ripley 48
  \code{\link{dim}},%         % do_dim()             [attrib.c]
77888 hornik 49
  % DispatchOrEval internal generic: dim<-
40176 ripley 50
  \code{\link{dim<-}},%       % do_dimgets()         [attrib.c]
77888 hornik 51
  % DispatchOrEval internal generic: names
40176 ripley 52
  \code{\link{names}},%       % do_names()           [attrib.c]
77888 hornik 53
  % DispatchOrEval internal generic: names<-
40176 ripley 54
  \code{\link{names<-}},%     % do_namesgets()       [attrib.c]
77888 hornik 55
  % DispatchOrEval internal generic: levels<-
40176 ripley 56
  \code{\link{levels<-}},%    % do_levelsgets()      [attrib.c]
83997 luke 57
  % DispatchOrEval internal generic: @
58
  \code{\link{@}},%           % do_AT()              [attrib.c]
77896 hornik 59
  % DispatchOrEval internal generic: @<-
84765 maechler 60
  \code{\link{@<-}},%         % do_attrgets()        [attrib.c]
40176 ripley 61
 
84765 maechler 62
  % DispatchOrEval internal generic: c
40176 ripley 63
  \code{\link{c}},%           % do_c()               [bind.c]
77888 hornik 64
  % DispatchOrEval internal generic: unlist
40176 ripley 65
  \code{\link{unlist}},%      % do_unlist()          [bind.c]
40685 ripley 66
  \code{\link{cbind}},%       not via DispatchOrEval [bind.c]
67
  \code{\link{rbind}},
40176 ripley 68
 
77888 hornik 69
  % DispatchOrEval internal generic: as.character
23358 ripley 70
  \code{\link{as.character}},
77888 hornik 71
  % DispatchOrEval internal generic: as.complex
41073 ripley 72
  \code{\link{as.complex}},
77888 hornik 73
  % DispatchOrEval internal generic: as.double
41073 ripley 74
  \code{\link{as.double}},
77888 hornik 75
  % DispatchOrEval internal generic: as.integer
41073 ripley 76
  \code{\link{as.integer}},
77888 hornik 77
  % DispatchOrEval internal generic: as.logical
41073 ripley 78
  \code{\link{as.logical}},
77888 hornik 79
  % DispatchOrEval internal generic: as.raw
41073 ripley 80
  \code{\link{as.raw}},
77888 hornik 81
  % DispatchOrEval internal generic: as.vector
77896 hornik 82
  \code{\link{as.vector}},%    % do_asvector()       [coerce.c]
83
  % DispatchOrEval internal generic: as.call
84
  \code{\link{as.call}},%      % do_ascall()         [coerce.c]
85
  % DispatchOrEval internal generic: as.environment
86
  \code{\link{as.environment}}%% do_as_environment() [envir.c]
77888 hornik 87
  % DispatchOrEval internal generic: is.array
23358 ripley 88
  \code{\link{is.array}},
77888 hornik 89
  % DispatchOrEval internal generic: is.matrix
23358 ripley 90
  \code{\link{is.matrix}},
77888 hornik 91
  % DispatchOrEval internal generic: is.na
40176 ripley 92
  \code{\link{is.na}},%       % do_isna()            [coerce.c]
77896 hornik 93
  % DispatchOrEval internal generic: anyNA
84765 maechler 94
  \code{\link{anyNA}},%       % do_anyNA()           [coerce.c]
77888 hornik 95
  % DispatchOrEval internal generic: is.nan
40176 ripley 96
  \code{\link{is.nan}},%      % do_isnan()           [coerce.c]
77896 hornik 97
  % DispatchOrEval internal generic: is.finite
98
  \code{\link{is.finite}}%    % do_isfinite()        [coerce.c]
99
  % DispatchOrEval internal generic: is.infinite
100
  \code{\link{is.infinite}}%    % do_isinfinite()    [coerce.c]
77888 hornik 101
  % DispatchOrEval internal generic: is.numeric
23358 ripley 102
  \code{\link{is.numeric}},
77896 hornik 103
  % DispatchOrEval internal generic: nchar
104
  \code{\link{nchar}}%          % do_nchar()         [character.c]
77888 hornik 105
  % DispatchOrEval internal generic: rep
50591 ripley 106
  \code{\link{rep}},%                                [seq.c]
77896 hornik 107
  % DispatchOrEval internal generic: rep.int
108
  \code{\link{rep.int}}%        % do_rep_int()       [seq.c]
109
  % DispatchOrEval internal generic: rep_len
110
  \code{\link{rep_len}}%        % do_rep_len()       [seq.c]
77888 hornik 111
  % DispatchOrEval internal generic: seq.int
40665 ripley 112
  \code{\link{seq.int}}
77896 hornik 113
  (which dispatches methods for \code{"seq"}),%      [seq.c]
114
  % DispatchOrEval internal generic: is.unsorted
115
  \code{\link{is.unsorted}}%    % do_isunsorted()    [sort.c]
77888 hornik 116
  and
117
  % DispatchOrEval internal generic: xtfrm
118
  \code{\link{xtfrm}}%                               [sort.c]
61433 ripley 119
 
89535 smeyer 120
  In addition, \code{\link{as.numeric}}
68372 maechler 121
  is a synonym for \code{as.double} and dispatches methods for the
122
  latter, i.e., S3 methods are for \code{as.double}, whereas S4 methods
123
  are to be written for \code{as.numeric}.
40208 ripley 124
 
42656 ripley 125
  Note that all of the \link{group generic} functions are also
40208 ripley 126
  internal/primitive and allow methods to be written for them.
40456 ripley 127
 
128
  \code{.S3PrimitiveGenerics} is a character vector listing the
84765 maechler 129
  primitives which are internal generic and not \link{group generic},
84767 maechler 130
  (not only for S3 but also S4).
84765 maechler 131
  Similarly, the \code{.internalGenerics} character vector contains the names
132
  of the internal (via \code{\link{.Internal}(..)}) non-primitive functions
133
  which are internally generic.
134
}
135
\note{
41079 ripley 136
  For efficiency, internal dispatch only occurs on \emph{objects}, that
137
  is those for which \code{\link{is.object}} returns true.
3986 ripley 138
}
139
\seealso{
40176 ripley 140
  \code{\link{methods}} for the methods which are available.
3986 ripley 141
}
142
\keyword{methods}