Check for a Sealed Method or Class
These functions check for either a method or a class that has been sealed when it was defined, and which therefore cannot be re-defined.
The quoted name of the generic function.
The class names in the method's signature, as
they would be supplied to
Optional, and usually omitted: the generic function
The quoted name of the class.
where to search for the method or class definition. By
default, searches from the top environment of the call to
In the R implementation of classes and methods, it is possible to seal the definition of either a class or a method. The basic classes (numeric and other types of vectors, matrix and array data) are sealed. So also are the methods for the primitive functions on those data types. The effect is that programmers cannot re-define the meaning of these basic data types and computations. More precisely, for primitive functions that depend on only one data argument, methods cannot be specified for basic classes. For functions (such as the arithmetic operators) that depend on two arguments, methods can be specified if one of those arguments is a basic class, but not if both are.
Programmers can seal other class and method definitions by using the
sealed argument to
The functions return
FALSE if the method or class is not
sealed (including the case that it is not defined);
Chambers, John M. (2008) Software for Data Analysis: Programming with R Springer. (For the R version.)
Chambers, John M. (1998) Programming with Data Springer (For the original S4 version.)
1 2 3 4 5 6 7 8 9 10 11 12
## these are both TRUE isSealedMethod("+", c("numeric", "character")) isSealedClass("matrix") setClass("track", slots = c(x="numeric", y="numeric")) ## but this is FALSE isSealedClass("track") ## and so is this isSealedClass("A Name for an undefined Class") ## and so are these, because only one of the two arguments is basic isSealedMethod("+", c("track", "numeric")) isSealedMethod("+", c("numeric", "track"))
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.