Find Class Definitions
Functions to find classes:
isClass tests for a class;
findClass returns the name(s) of packages containing the
getClasses returns the names of all the classes in an
environment, typically a namespace. To examine the definition of a class, use
1 2 3 4 5 6 7 8 9 10 11 12 13 14
character string name for the class. The functions will
usually take a class definition instead of the string. To restrict
the class to those defined in a particular package, set the
To restrict the search to classes in a particular package, use
in a call to
Is this the name of a formally defined class?
The names of all the classes formally defined on
where. If called with no argument, all the classes visible from the calling function (if called from the top-level, all the classes in any of the environments on the search list). The
whereargument is used to search only in a particular package.
The list of environments in which a class definition of
Classis found. If
whereis supplied, a list is still returned, either empty or containing the environment corresponding to
where. By default when called from the R session, the global environment and all the currently attached packages are searched.
uniqueis supplied as a character string,
findClasswill warn if there is more than one definition visible (using the string to identify the purpose of the call), and will generate an error if no definition can be found.
The remaining functions are retained for back-compatibility and internal use, but not generally recommended.
Remove the definition of this class. This can't be used if the class is in another package, and would rarely be needed in source code defining classes in a package.
Reset the internal definition of a class. Not legitimate for a class definition not in this package and rarely needed otherwise.
Seal the current definition of the specified class, to prevent further changes, by setting the corresponding slot in the class definition. This is rarely used, since classes in loaded packages are sealed by locking their namespace.
Chambers, John M. (2016) Extending R, Chapman & Hall. (Chapters 9 and 10.)
Chambers, John M. (2008) Software for Data Analysis: Programming with R Springer. (Chapter 9 has some details not in the later reference.)
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.