| Line 1... |
Line 1... |
| 1 |
% File src/library/utils/man/isS3method.Rd
|
1 |
% File src/library/utils/man/isS3method.Rd
|
| 2 |
% Part of the R package, https://www.R-project.org
|
2 |
% Part of the R package, https://www.R-project.org
|
| 3 |
% Copyright 1995-2015 R Core Team
|
3 |
% Copyright 1995-2016 R Core Team
|
| 4 |
% Distributed under GPL 2 or later
|
4 |
% Distributed under GPL 2 or later
|
| 5 |
|
5 |
|
| 6 |
\name{isS3method}
|
6 |
\name{isS3method}
|
| 7 |
\alias{isS3method}
|
7 |
\alias{isS3method}
|
| 8 |
\title{Is 'method' the Name of an S3 Method?}
|
8 |
\title{Is 'method' the Name of an S3 Method?}
|
| Line 40... |
Line 40... |
| 40 |
isS3method("t.ts") # TRUE
|
40 |
isS3method("t.ts") # TRUE
|
| 41 |
isS3method("t.test") # FALSE
|
41 |
isS3method("t.test") # FALSE
|
| 42 |
isS3method("t.data.frame")# TRUE
|
42 |
isS3method("t.data.frame")# TRUE
|
| 43 |
isS3method("t.lm") # FALSE - not existing
|
43 |
isS3method("t.lm") # FALSE - not existing
|
| 44 |
isS3method("t.foo.bar") # FALSE - not existing
|
44 |
isS3method("t.foo.bar") # FALSE - not existing
|
| - |
|
45 |
|
| - |
|
46 |
## S3 methods with "4 parts" in their name:
|
| - |
|
47 |
ff <- c("as.list", "as.matrix", "is.na", "row.names", "row.names<-")
|
| - |
|
48 |
for(m in ff) if(isS3method(m)) stop("wrongly declared an S3 method: ", m)
|
| - |
|
49 |
(m4 <- paste(ff, "data.frame", sep="."))
|
| - |
|
50 |
for(m in m4) if(!isS3method(m)) stop("not an S3 method: ", m)
|
| 45 |
\dontshow{
|
51 |
\dontshow{
|
| 46 |
stopifnot(
|
52 |
stopifnot(
|
| 47 |
!isS3method("t"), !isS3method("t.test"), !isS3method("qr.coef"), !isS3method("sort.list"),
|
53 |
!isS3method("t"), !isS3method("t.test"), !isS3method("qr.coef"), !isS3method("sort.list"),
|
| 48 |
isS3method("t.default"), isS3method("t.ts"), isS3method("t.data.frame"),
|
54 |
isS3method("t.default"), isS3method("t.ts"), isS3method("t.data.frame"),
|
| 49 |
!isS3method("t.lm"), !isS3method("t.foo.bar"))
|
55 |
!isS3method("t.lm"), !isS3method("t.foo.bar"))
|