EVOLUTION-MANAGER
Edit File: make.names.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: Make Syntactically Valid Names</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 make.names {base}"><tr><td>make.names {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Make Syntactically Valid Names</h2> <h3>Description</h3> <p>Make syntactically valid names out of character vectors. </p> <h3>Usage</h3> <pre> make.names(names, unique = FALSE, allow_ = TRUE) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>names</code></td> <td> <p>character vector to be coerced to syntactically valid names. This is coerced to character if necessary.</p> </td></tr> <tr valign="top"><td><code>unique</code></td> <td> <p>logical; if <code>TRUE</code>, the resulting elements are unique. This may be desired for, e.g., column names.</p> </td></tr> <tr valign="top"><td><code>allow_</code></td> <td> <p>logical. For compatibility with <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> prior to 1.9.0.</p> </td></tr> </table> <h3>Details</h3> <p>A syntactically valid name consists of letters, numbers and the dot or underline characters and starts with a letter or the dot not followed by a number. Names such as <code>".2way"</code> are not valid, and neither are the <a href="Reserved.html">reserved</a> words. </p> <p>The definition of a <em>letter</em> depends on the current locale, but only ASCII digits are considered to be digits. </p> <p>The character <code>"X"</code> is prepended if necessary. All invalid characters are translated to <code>"."</code>. A missing value is translated to <code>"NA"</code>. Names which match <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> keywords have a dot appended to them. Duplicated values are altered by <code><a href="make.unique.html">make.unique</a></code>. </p> <h3>Value</h3> <p>A character vector of same length as <code>names</code> with each changed to a syntactically valid name, in the current locale's encoding. </p> <h3>Warning</h3> <p>Some OSes, notably FreeBSD, report extremely incorrect information about which characters are alphabetic in some locales (typically, all multi-byte locales including UTF-8 locales). However, <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> provides substitutes on Windows, macOS and AIX. </p> <h3>Note</h3> <p>Prior to <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> version 1.9.0, underscores were not valid in variable names, and code that relies on them being converted to dots will no longer work. Use <code>allow_ = FALSE</code> for back-compatibility. </p> <p><code>allow_ = FALSE</code> is also useful when creating names for export to applications which do not allow underline in names (for example, S-PLUS and some DBMSs). </p> <h3>See Also</h3> <p><code><a href="make.unique.html">make.unique</a></code>, <code><a href="names.html">names</a></code>, <code><a href="character.html">character</a></code>, <code><a href="data.frame.html">data.frame</a></code>. </p> <h3>Examples</h3> <pre> make.names(c("a and b", "a-and-b"), unique = TRUE) # "a.and.b" "a.and.b.1" make.names(c("a and b", "a_and_b"), unique = TRUE) # "a.and.b" "a_and_b" make.names(c("a and b", "a_and_b"), unique = TRUE, allow_ = FALSE) # "a.and.b" "a.and.b.1" make.names(c("", "X"), unique = TRUE) # "X.1" "X" currently; R up to 3.0.2 gave "X" "X.1" state.name[make.names(state.name) != state.name] # those 10 with a space </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>