EVOLUTION-MANAGER
Edit File: callGeneric.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: Call the Current Generic Function from a 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 callGeneric {methods}"><tr><td>callGeneric {methods}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Call the Current Generic Function from a Method</h2> <h3>Description</h3> <p>A call to <code>callGeneric</code> can only appear inside a method definition. It then results in a call to the current generic function. The value of that call is the value of <code>callGeneric</code>. While it can be called from any method, it is useful and typically used in methods for group generic functions. </p> <h3>Usage</h3> <pre> callGeneric(...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>...</code></td> <td> <p>Optionally, the arguments to the function in its next call. </p> <p>If no arguments are included in the call to <code>callGeneric</code>, the effect is to call the function with the current arguments. See the detailed description for what this really means. </p> </td></tr> </table> <h3>Details</h3> <p>The name and package of the current generic function is stored in the environment of the method definition object. This name is looked up and the corresponding function called. </p> <p>The statement that passing no arguments to <code>callGeneric</code> causes the generic function to be called with the current arguments is more precisely as follows. Arguments that were missing in the current call are still missing (remember that <code>"missing"</code> is a valid class in a method signature). For a formal argument, say <code>x</code>, that appears in the original call, there is a corresponding argument in the generated call equivalent to <code>x = x</code>. In effect, this means that the generic function sees the same actual arguments, but arguments are evaluated only once. </p> <p>Using <code>callGeneric</code> with no arguments is prone to creating infinite recursion, unless one of the arguments in the signature has been modified in the current method so that a different method is selected. </p> <h3>Value</h3> <p>The value returned by the new call. </p> <h3>References</h3> <p>Chambers, John M. (2016) <em>Extending R</em>, Chapman & Hall. (Chapters 9 and 10.) </p> <p>Chambers, John M. (2008) <em>Software for Data Analysis: Programming with R</em> Springer. (Section 10.4 for some details.) </p> <h3>See Also</h3> <p><code><a href="S4groupGeneric.html">GroupGenericFunctions</a></code> for other information about group generic functions; <a href="Methods_Details.html">Methods_Details</a> for the general behavior of method dispatch </p> <h3>Examples</h3> <pre> ## the method for group generic function Ops ## for signature( e1="structure", e2="vector") function (e1, e2) { value <- callGeneric(e1@.Data, e2) if (length(value) == length(e1)) { e1@.Data <- value e1 } else value } ## For more examples ## Not run: showMethods("Ops", includeDefs = TRUE) ## End(Not run) </pre> <hr /><div style="text-align: center;">[Package <em>methods</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>