make.names | R Documentation |
Make syntactically valid names out of character vectors.
make.names(names, unique = F)
names |
character (vector) to be coerced to syntactically valid names. |
unique |
logical; if |
A syntactically valid name consists of letters, numbers, and the dot character and starts with a letter or the dot.
All invalid characters are translated to "."
. A missing value is
translated to "NA"
. Names which match R keywords have a dot appended
to them.
If unique = TRUE
then make.unique
is used to append
sequence numbers to duplicates (after coercion).
A character vector of same length as names
with each changed
to a syntactically valid name.
names
, character
,
data.frame
.
make.names(c("a and b", "a_and_b"), unique=TRUE) # "a.and.b" "a.and.b1" data(state) state.name[make.names(state.name) != state.name]# those 10 with a space
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.