EVOLUTION-MANAGER
Edit File: isS4.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Test for an S4 object</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for isS4 {base}"><tr><td>isS4 {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2> Test for an S4 object </h2> <h3>Description</h3> <p>Tests whether the object is an instance of an S4 class. </p> <h3>Usage</h3> <pre> isS4(object) asS4(object, flag = TRUE, complete = TRUE) asS3(object, flag = TRUE, complete = TRUE) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>object</code></td> <td> <p>Any R object.</p> </td></tr> <tr valign="top"><td><code>flag</code></td> <td> <p>Optional, logical: indicate direction of conversion.</p> </td></tr> <tr valign="top"><td><code>complete</code></td> <td> <p>Optional, logical: whether conversion to S3 is completed. Not usually needed, but see the details section.</p> </td></tr> </table> <h3>Details</h3> <p>Note that <code>isS4</code> does not rely on the <span class="pkg">methods</span> package, so in particular it can be used to detect the need to <code><a href="library.html">require</a></code> that package. </p> <p><code>asS3</code> uses the value of <code>complete</code> to control whether an attempt is made to transform <code>object</code> into a valid object of the implied S3 class. If <code>complete</code> is <code>TRUE</code>, then an object from an S4 class extending an S3 class will be transformed into an S3 object with the corresponding S3 class (see <code><a href="../../methods/html/S3Part.html">S3Part</a></code>). This includes classes extending the pseudo-classes <code>array</code> and <code>matrix</code>: such objects will have their class attribute set to <code>NULL</code>. </p> <p><code>isS4</code> is <a href="Primitive.html">primitive</a>. </p> <h3>Value</h3> <p><code>isS4</code> always returns <code>TRUE</code> or <code>FALSE</code> according to whether the internal flag marking an S4 object has been turned on for this object. </p> <p><code>asS4</code> and <code>asS3</code> will turn this flag on or off, and <code>asS3</code> will set the class from the objects <code>.S3Class</code> slot if one exists. Note that <code>asS3</code> will <em>not</em> turn the object into an S3 object unless there is a valid conversion; that is, an object of type other than <code>"S4"</code> for which the S4 object is an extension, unless argument <code>complete</code> is <code>FALSE</code>. </p> <h3>See Also</h3> <p><code><a href="is.object.html">is.object</a></code> for a more general test; <a href="../../methods/html/Introduction.html">Introduction</a> for general information on S4; <a href="../../methods/html/Classes_Details.html">Classes_Details</a> for more on S4 class definitions. </p> <h3>Examples</h3> <pre> isS4(pi) # FALSE isS4(getClass("MethodDefinition")) # TRUE </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>