Class names including the corresponding package
className() generates a
valid references to a class, including the name of the package
containing the class definition. The object returned, from class
"className", is the
unambiguous way to refer to a class, for example when calling
setMethod, just in case multiple definitions of the
"multipleClasses" returns information about multiple
definitions of classes with the
same name from different packages.
1 2 3
The character string name of a class and, optionally, of the package
to which it belongs. If argument
If there is no package argument or slot, a definition for the class must exist and will be used to define the package. If there are multiple definitions, one will be chosen and a warning printed giving the other possibilities.
The table of class definitions used internally can maintain multiple
definitions for classes with the same name but coming from different
If identical class definitions are encountered, only one class
definition is kept; this occurs most often with S3 classes that have
been specified in calls to
setOldClass. For true
classes, multiple class definitions are unavoidable in general if two
packages happen to have used the same name, independently.
Overriding a class definition in another package with the same name deliberately is usually a bad idea. Although R attempts to keep and use the two definitions (as of version 2.14.0), ambiguities are always possible. It is more sensible to define a new class that extends an existing class but has a different name.
A call to
className() returns an object from class
A call to
multipleClasses() returns either a character
vector or a named list of class definitions. In either case, testing
the length of the returned value for being greater than
0 is a
check for the existence of multiply defined classes.
Objects from the Class
"character" and has a slot
"package", also of class
1 2 3 4 5 6 7 8
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.