isClass(what, formal)
TRUE
(the default), only formally defined classes
qualify. (See discussion of value returned.)
TRUE
or
FALSE
according to whether the string
corresponds to a currently defined class.
Since S supports both formally and informally defined classes,
the test used depends on whether the latter are to be included or not.
A formally defined class is one for which a specification exists somewhere in the
meta-data for the currently attached chapters.
(It need not have slots, and can be a virtual class.)
An informally defined class also includes any name that has been used as a class
name sometime in the current session.
In particular, this includes old-style S classes.
Because there is no way to determine the existence of these classes
except by handling an object that has the class,
the value of
isClass
with
formal=FALSE
depends on what computations have come before in the session. See the example.
isClass("numeric") # a class always included with S isClass("data.frame") # an informal, old-style class isClass("data.frame", F) # we haven't encountered it yet dim(fuel.frame) # fuel.frame is a data.frame object isClass("data.frame", F)