EVOLUTION-MANAGER
Edit File: hasArg.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: Look for an Argument in the Call</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 hasArg {methods}"><tr><td>hasArg {methods}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Look for an Argument in the Call</h2> <h3>Description</h3> <p>Returns <code>TRUE</code> if <code>name</code> corresponds to an argument in the call, either a formal argument to the function, or a component of <code>...</code>, and <code>FALSE</code> otherwise. </p> <h3>Usage</h3> <pre> hasArg(name) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>name</code></td> <td> <p>The name of a potential argument, as an unquoted name or character string.</p> </td></tr> </table> <h3>Details</h3> <p>The expression <code>hasArg(x)</code>, for example, is similar to <code>!missing(x)</code>, with two exceptions. First, <code>hasArg</code> will look for an argument named <code>x</code> in the call if <code>x</code> is not a formal argument to the calling function, but <code>...</code> is. Second, <code>hasArg</code> never generates an error if given a name as an argument, whereas <code>missing(x)</code> generates an error if <code>x</code> is not a formal argument. </p> <h3>Value</h3> <p>Always <code>TRUE</code> or <code>FALSE</code> as described above. </p> <h3>See Also</h3> <p><code><a href="../../base/html/missing.html">missing</a></code> </p> <h3>Examples</h3> <pre> ftest <- function(x1, ...) c(hasArg(x1), hasArg("y2")) ftest(1) ## c(TRUE, FALSE) ftest(1, 2) ## c(TRUE, FALSE) ftest(y2 = 2) ## c(FALSE, TRUE) ftest(y = 2) ## c(FALSE, FALSE) (no partial matching) ftest(y2 = 2, x = 1) ## c(TRUE, TRUE) partial match x1 </pre> <hr /><div style="text-align: center;">[Package <em>methods</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>