Читать книгу The Big R-Book - Philippe J. S. De Brouwer - Страница 218
Note – Nuances in the OO system
ОглавлениеThe downside of the function centricOOsystem is that some things become a little subtle. Earlier we explained how to use isS4()
. There is no function isS3()
, but one will notice that is.S3()
exists. Now, you will understand that is.S3()
is the S3 specific method of the function is()
.
Looking up the source code can be helpful:
is.S3
## function(x){is.object(x) & !isS4(x)}
## <bytecode: 0x5634256e9f60>
There are many functions related to S4 objects, and it is not the aim to provide a full list however, the following might be useful for your code.
getGenerics() lists all S4 generics;
getGenerics()
getClasses() lists all S4 classes (it does however, include shim classes for S3 classes and base types);
getClasses()
showMethods() shows the methods for one or more generic functions, possibly restricted to those involving specified classes. Note that the argument where can be used to restrict the search to the current environment by using where = search();
showMethods()