EVOLUTION-MANAGER
Edit File: method.skeleton.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: Create a Skeleton File for a New 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 method.skeleton {methods}"><tr><td>method.skeleton {methods}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Create a Skeleton File for a New Method</h2> <h3>Description</h3> <p>This function writes a source file containing a call to <code><a href="setMethod.html">setMethod</a></code> to define a method for the generic function and signature supplied. By default the method definition is in line in the call, but can be made an external (previously assigned) function. </p> <h3>Usage</h3> <pre> method.skeleton(generic, signature, file, external = FALSE, where) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>generic</code></td> <td> <p>the character string name of the generic function, or the generic function itself. In the first case, the function need not currently be a generic, as it would not for the resulting call to <code><a href="setMethod.html">setMethod</a></code>.</p> </td></tr> <tr valign="top"><td><code>signature</code></td> <td> <p>the method signature, as it would be given to <code><a href="setMethod.html">setMethod</a></code></p> </td></tr> <tr valign="top"><td><code>file</code></td> <td> <p>a character string name for the output file, or a writable connection. By default the generic function name and the classes in the signature are concatenated, with separating underscore characters. The file name should normally end in <code>".R"</code>. </p> </td></tr> </table> <p>To write multiple method skeletons to one file, open the file connection first and then pass it to <code>method.skeleton()</code> in multiple calls. </p> <table summary="R argblock"> <tr valign="top"><td><code>external</code></td> <td> <p>flag to control whether the function definition for the method should be a separate external object assigned in the source file, or included in line in the call to <code><a href="setMethod.html">setMethod</a></code>. If supplied as a character string, this will be used as the name for the external function; by default the name concatenates the generic and signature names, with separating underscores.</p> </td></tr> <tr valign="top"><td><code>where</code></td> <td> <p>The environment in which to look for the function; by default, the top-level environment of the call to <code>method.skeleton</code>.</p> </td></tr> </table> <h3>Value</h3> <p>The <code>file</code> argument, invisibly, but the function is used for its side effect. </p> <h3>See Also</h3> <p><code><a href="setMethod.html">setMethod</a></code>, <code><a href="../../utils/html/package.skeleton.html">package.skeleton</a></code> </p> <h3>Examples</h3> <pre> setClass("track", slots = c(x ="numeric", y="numeric")) method.skeleton("show", "track") ## writes show_track.R method.skeleton("Ops", c("track", "track")) ## writes "Ops_track_track.R" ## write multiple method skeletons to one file con <- file("./Math_track.R", "w") method.skeleton("Math", "track", con) method.skeleton("exp", "track", con) method.skeleton("log", "track", con) close(con) </pre> <hr /><div style="text-align: center;">[Package <em>methods</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>