Returns a logical value or an integer vector indicating from which classes
x
inherits.
USAGE:
inherits(x, what, which=F)
REQUIRED ARGUMENTS:
x
any object, possibly but not necessarily having a class attribute.
what
a character vector of possible classes.
OPTIONAL ARGUMENTS:
which
logical flag: if
TRUE, specify which classes matched the object; if
FALSE,
just say whether any classes matched the object.
VALUE:
if which is
FALSE, a single logical value. The value is
TRUE if any
of the classes in the class
attribute of
x match (exactly) any of the strings in
what.
if
which is
TRUE, an integer vector of the same length as
what
that contains the position in the class of
x that each value in
what
matches.
A zero is returned for elements of
what that dont match any element of the
class.
SEE ALSO:
.
EXAMPLES:
# the definition of as.factor
function(x) if(inherits(x,"factor")) x else factor(x)
inherits(y~x, c("formula", "terms"))