name | R Documentation |
This function is well suited to modifying the name of an object in a pipeline.
It can be thought of as the verb corresponding to the noun 'names'.
Convenient functions to modify names using regular expressions are
spida2::sub_
and spida2::gsub_
.
See also uname
.
name(x, nam = x, ...)
col_name(x, nam = x, ...)
row_name(x, nam = x, ...)
x |
object to be named or renamed with a 'names', 'colnames' or 'rownames' attribute |
nam |
vector of names or a function |
... |
additional arguments to used by |
x with a modified name. If nam
is a function then the names attribute
is modified with names(x) <- nam(names(x), ...)
.
## Not run:
x <- as.list(letters[1:3])
x
name(x)
library(magrittr)
x %>% name %>% name(toupper)
x %>% name %>% name(sub_, '(.*)', 'time_\\1')
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.