EVOLUTION-MANAGER
Edit File: setNames.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: Set the Names in an Object</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 setNames {stats}"><tr><td>setNames {stats}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Set the Names in an Object</h2> <h3>Description</h3> <p>This is a convenience function that sets the names on an object and returns the object. It is most useful at the end of a function definition where one is creating the object to be returned and would prefer not to store it under a name just so the names can be assigned. </p> <h3>Usage</h3> <pre> setNames(object = nm, nm) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>object</code></td> <td> <p>an object for which a <code>names</code> attribute will be meaningful </p> </td></tr> <tr valign="top"><td><code>nm</code></td> <td> <p>a character vector of names to assign to the object</p> </td></tr> </table> <h3>Value</h3> <p>An object of the same sort as <code>object</code> with the new names assigned. </p> <h3>Author(s)</h3> <p>Douglas M. Bates and Saikat DebRoy </p> <h3>See Also</h3> <p><code><a href="../../base/html/unname.html">unname</a></code> for removing names. </p> <h3>Examples</h3> <pre> setNames( 1:3, c("foo", "bar", "baz") ) # this is just a short form of tmp <- 1:3 names(tmp) <- c("foo", "bar", "baz") tmp ## special case of character vector, using default setNames(nm = c("First", "2nd")) </pre> <hr /><div style="text-align: center;">[Package <em>stats</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>