EVOLUTION-MANAGER
Edit File: isS3method.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: Is 'method' the Name of an S3 Method?</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 isS3method {utils}"><tr><td>isS3method {utils}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Is 'method' the Name of an S3 Method?</h2> <h3>Description</h3> <p>Checks if <code>method</code> is the name of a valid / registered S3 method. Alternatively, when <code>f</code> and <code>class</code> are specified, it is checked if <code>f</code> is the name of an S3 generic function and <code>paste(f, class, sep=".")</code> is a valid S3 method. </p> <h3>Usage</h3> <pre> isS3method(method, f, class, envir = parent.frame()) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>method</code></td> <td> <p>a character string, typically of the form <code>"<fn>.<class>"</code>. If omitted, <code>f</code> and <code>class</code> have to be specified instead.</p> </td></tr> <tr valign="top"><td><code>f</code></td> <td> <p>optional character string, typically specifying an S3 generic function. Used, when <code>method</code> is not specified.</p> </td></tr> <tr valign="top"><td><code>class</code></td> <td> <p>optional character string, typically specifying an S3 class name. Used, when <code>method</code> is not specified.</p> </td></tr> <tr valign="top"><td><code>envir</code></td> <td> <p>the <code><a href="../../base/html/environment.html">environment</a></code> in which the method and its generic are searched first, as in <code><a href="getS3method.html">getS3method</a>()</code>.</p> </td></tr> </table> <h3>Value</h3> <p><code><a href="../../base/html/logical.html">logical</a></code> <code>TRUE</code> or <code>FALSE</code> </p> <h3>See Also</h3> <p><code><a href="methods.html">methods</a></code>, <code><a href="getS3method.html">getS3method</a></code>. </p> <h3>Examples</h3> <pre> isS3method("t") # FALSE - it is an S3 generic isS3method("t.default") # TRUE isS3method("t.ts") # TRUE isS3method("t.test") # FALSE isS3method("t.data.frame")# TRUE isS3method("t.lm") # FALSE - not existing isS3method("t.foo.bar") # FALSE - not existing ## S3 methods with "4 parts" in their name: ff <- c("as.list", "as.matrix", "is.na", "row.names", "row.names<-") for(m in ff) if(isS3method(m)) stop("wrongly declared an S3 method: ", m) (m4 <- paste(ff, "data.frame", sep=".")) for(m in m4) if(!isS3method(m)) stop("not an S3 method: ", m) </pre> <hr /><div style="text-align: center;">[Package <em>utils</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>