EVOLUTION-MANAGER
Edit File: hasName.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: Check for Name</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 hasName {utils}"><tr><td>hasName {utils}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Check for Name</h2> <h3>Description</h3> <p><code>hasName</code> is a convenient way to test for one or more names in an R object. </p> <h3>Usage</h3> <pre> hasName(x, name) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>Any object.</p> </td></tr> <tr valign="top"><td><code>name</code></td> <td> <p>One or more character values to look for.</p> </td></tr> </table> <h3>Details</h3> <p><code>hasName(x, name)</code> is defined to be equivalent to <code>name %in% names(x)</code>, though it will evaluate slightly more quickly. It is intended to replace the common idiom <code>!is.null(x$name)</code>. The latter can be unreliable due to partial name matching; see the example below. </p> <h3>Value</h3> <p>A logical vector of the same length as <code>name</code> containing <code>TRUE</code> if the corresponding entry is in <code>names(x)</code>. </p> <h3>See Also</h3> <p><code><a href="../../base/html/match.html">%in%</a></code>, <code><a href="../../base/html/exists.html">exists</a></code> </p> <h3>Examples</h3> <pre> x <- list(abc = 1, def = 2) !is.null(x$abc) # correct !is.null(x$a) # this is the wrong test! hasName(x, "abc") hasName(x, "a") </pre> <hr /><div style="text-align: center;">[Package <em>utils</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>