| 42333 |
ripley |
1 |
% File src/library/base/man/zMethods.Rd
|
|
|
2 |
% Part of the R package, http://www.R-project.org
|
| 59039 |
ripley |
3 |
% Copyright 1995-2007 R Core Team
|
| 42333 |
ripley |
4 |
% Distributed under GPL 2 or later
|
|
|
5 |
|
| 23610 |
ripley |
6 |
\name{InternalMethods}
|
| 56186 |
murdoch |
7 |
\alias{InternalMethods}
|
| 39493 |
ripley |
8 |
\alias{InternalGenerics}
|
|
|
9 |
\alias{internal generic}
|
| 40456 |
ripley |
10 |
\alias{.S3PrimitiveGenerics}
|
| 23610 |
ripley |
11 |
\title{Internal Generic Functions}
|
| 23613 |
ripley |
12 |
\description{
|
|
|
13 |
Many \R-internal functions are \emph{generic} and allow
|
| 23610 |
ripley |
14 |
methods to be written for.
|
| 23291 |
hornik |
15 |
}
|
| 3986 |
ripley |
16 |
|
| 23291 |
hornik |
17 |
% -------------------- grep -nw DispatchOrEval src/*/*[ch]
|
|
|
18 |
% --------------
|
| 49649 |
ripley |
19 |
\details{
|
| 38997 |
ripley |
20 |
The following primitive and internal functions are \emph{generic},
|
|
|
21 |
i.e., you can write \code{\link{methods}} for them:
|
| 3986 |
ripley |
22 |
|
| 40176 |
ripley |
23 |
\code{\link{[}},% % do_subset() [subset.c]
|
|
|
24 |
\code{\link{[[}},% % do_subset2() [subset.c]
|
| 23358 |
ripley |
25 |
\code{\link{$}},
|
|
|
26 |
\code{\link{[<-}},
|
|
|
27 |
\code{\link{[[<-}},
|
|
|
28 |
\code{\link{$<-}},
|
|
|
29 |
|
| 40176 |
ripley |
30 |
\code{\link{length}},% % do_length() [array.c]
|
|
|
31 |
\code{\link{length<-}},% % do_lengthgets() [builtin.c]
|
|
|
32 |
\code{\link{dimnames}},% % do_dimnames() [attrib.c]
|
|
|
33 |
\code{\link{dimnames<-}},% % do_dimnamesgets() [attrib.c]
|
|
|
34 |
\code{\link{dim}},% % do_dim() [attrib.c]
|
|
|
35 |
\code{\link{dim<-}},% % do_dimgets() [attrib.c]
|
|
|
36 |
\code{\link{names}},% % do_names() [attrib.c]
|
|
|
37 |
\code{\link{names<-}},% % do_namesgets() [attrib.c]
|
|
|
38 |
\code{\link{levels<-}},% % do_levelsgets() [attrib.c]
|
|
|
39 |
|
|
|
40 |
\code{\link{c}},% % do_c() [bind.c]
|
|
|
41 |
\code{\link{unlist}},% % do_unlist() [bind.c]
|
| 40685 |
ripley |
42 |
\code{\link{cbind}},% not via DispatchOrEval [bind.c]
|
|
|
43 |
\code{\link{rbind}},
|
| 40176 |
ripley |
44 |
|
| 23358 |
ripley |
45 |
\code{\link{as.character}},
|
| 41073 |
ripley |
46 |
\code{\link{as.complex}},
|
|
|
47 |
\code{\link{as.double}},
|
|
|
48 |
\code{\link{as.integer}},
|
|
|
49 |
\code{\link{as.logical}},
|
|
|
50 |
\code{\link{as.raw}},
|
| 40176 |
ripley |
51 |
\code{\link{as.vector}},% % do_asvector() [coerce.c]
|
| 23358 |
ripley |
52 |
\code{\link{is.array}},
|
|
|
53 |
\code{\link{is.matrix}},
|
| 40176 |
ripley |
54 |
\code{\link{is.na}},% % do_isna() [coerce.c]
|
|
|
55 |
\code{\link{is.nan}},% % do_isnan() [coerce.c]
|
| 23358 |
ripley |
56 |
\code{\link{is.numeric}},
|
| 50591 |
ripley |
57 |
\code{\link{rep}},% [seq.c]
|
| 40665 |
ripley |
58 |
\code{\link{seq.int}}
|
| 50591 |
ripley |
59 |
(which dispatches methods for \code{"seq"})% [seq.c]
|
| 50584 |
ripley |
60 |
and \code{\link{xtfrm}}% [sort.c]
|
| 61433 |
ripley |
61 |
|
| 40182 |
ripley |
62 |
In addition, \code{is.name} is a synonym for \code{is.symbol} and
|
| 40685 |
ripley |
63 |
dispatches methods for the latter.
|
| 40208 |
ripley |
64 |
|
| 42656 |
ripley |
65 |
Note that all of the \link{group generic} functions are also
|
| 40208 |
ripley |
66 |
internal/primitive and allow methods to be written for them.
|
| 40456 |
ripley |
67 |
|
|
|
68 |
\code{.S3PrimitiveGenerics} is a character vector listing the
|
|
|
69 |
primitives which are internal generic and not \link{group generic}.
|
| 44156 |
ripley |
70 |
Currently \code{\link{as.vector}}, \code{\link{cbind}},
|
|
|
71 |
\code{\link{rbind}} and \code{\link{unlist}} are the internal
|
|
|
72 |
non-primitive functions which are internally generic.
|
| 41079 |
ripley |
73 |
|
|
|
74 |
For efficiency, internal dispatch only occurs on \emph{objects}, that
|
|
|
75 |
is those for which \code{\link{is.object}} returns true.
|
| 3986 |
ripley |
76 |
}
|
|
|
77 |
\seealso{
|
| 40176 |
ripley |
78 |
\code{\link{methods}} for the methods which are available.
|
| 3986 |
ripley |
79 |
}
|
|
|
80 |
\keyword{methods}
|