isS4 {base}R Documentation

Test for an S4 object

Description

Tests whether the object was created from a formally defined class.

Usage

isS4(object)

asS4(object, value = TRUE)

Arguments

object Any R object.
value A single logical value; not NA.

Details

Note that this function does not rely on the methods package, so in particular it can be used to detect the need to require() that package.

You should not set the flag directly unless you really know why. In the future, S4 methods may be restricted S4 objects, for primitive functions; then asS4 would allow method dispatch of S4 methods for S3 classes. For all other purposes, an object will satisfy isS4(x) if and only if it should.

Value

isS4 always returns TRUE or FALSE according to whether the internal flag marking an S4 object has been turned on for this object.
asS4 will turn this flag on or off. But see the details.

Examples


isS4(pi) # FALSE
isS4(getClass("MethodDefinition")) # TRUE


[Package base version 2.4.1 Index]