methods (version 3.3)

findClass: Computations with Classes

Description

Functions to find and manipulate class definitions.

Usage

isClass(Class, formal=TRUE, where)

getClasses(where, inherits = missing(where))

findClass(Class, where, unique = "")

removeClass(Class, where, resolve.msg = getOption("removeClass.msg", default=TRUE))

resetClass(Class, classDef, where)

sealClass(Class, where)

Arguments

Class
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 packageSlot of the character string.
where
the environment in which to modify or remove the definition. Defaults to the top-level environment of the calling function (the global environment for ordinary computations, but the environment or namespace of a package in the source for a package).

When searching for class definitions, where defines where to do the search, and the default is to search from the top-level environment or namespace of the caller to this function.

formal
logical indicating if a formal definition is required.
unique
if findClass expects a unique location for the class, unique is a character string explaining the purpose of the search (and is used in warning and error messages). By default, multiple locations are possible and the function always returns a list.
inherits
in a call to getClasses, should the value returned include all parent environments of where, or that environment only? Defaults to TRUE if where is omitted, and to FALSE otherwise.
resolve.msg
logical indicating if Rshould message() its decision if Class is found in multiple namespaces and one is chosen.
classDef
For resetClass, the optional class definition (but usually it's better for Class to be the class definition, and to omit classDef).

Details

These are the functions that test and manipulate formal class definitions. Brief documentation is provided below. See the references for an introduction and for more details.

[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

References

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.)

See Also

setClassUnion, Methods, makeClassRepresentation