
setNames(object = nm, nm)
names
attribute will be meaningful object
with the new names assigned.
unname
for removing names.
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"))
Run the code above in your browser using DataLab