Usage
## S3 method for class 'default}(name, envir=parent.frame(), ellipsesOnly=TRUE, dontWarn=getOption("dontWarnPkgs"), enforceRCC=TRUE, ...)':
setGenericS3undefined
- name
{The name of the generic function.}
- envir
{The environment for where this method should be stored.}
- ellipsesOnly
{If TRUE
, the only arguments in the generic function
will be ...
.}
- dontWarn
{If a non-generic method with the same name is found it
will be "renamed" to a default method. If that method is found in
a package with a name that is not found in dontWarn
a warning will be produced, otherwise it will be renamed silently.}
- ...
{Not used.}
myCat.matrix <- function(..., sep=", ") {
cat("A matrix:
");
cat(..., sep=sep);
cat("
");
}
myCat.default <- function(..., sep=", ") {
cat(..., sep=sep);
cat("
");
}
setGenericS3("myCat");
myCat(1:10);
mat <- matrix(1:10, ncol=5);
attr(mat, "class") <- "matrix"; # Has to be done as of [R] V1.4.0.
myCat(mat);
To define a method for a class see setMethodS3
().
For a thorough example of how to use this method see Object
.
[object Object]
programming
methods
internal