Description Usage Arguments Details Value See Also Examples
Adds a prefix or suffix to the names attributes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | nm_prefix(x, prefix, sep = "", ...)
## Default S3 method:
nm_prefix(x, prefix, sep = "", ...)
## S3 method for class 'data.frame'
nm_prefix(x, prefix, sep = "", ...)
## S3 method for class 'data.table'
nm_prefix(x, prefix, sep = "", exclude_key = TRUE)
nm_suffix(x, suffix, sep = "", ...)
## Default S3 method:
nm_suffix(x, suffix, sep = "", ...)
## S3 method for class 'data.frame'
nm_suffix(x, suffix, sep = "", ...)
## S3 method for class 'data.table'
nm_suffix(x, suffix, sep = "", ..., exclude_key = TRUE)
|
x |
object with a names attribute |
prefix |
character; prefix collapsed to string by |
sep |
string used to collapse and seperate |
... |
additional arguments |
exclude_key |
logical; if |
suffix |
character; collapsed to string by |
nm_prefix
and nm_suffix
add a prefix or suffix to the names of
an object.
The method for data.table objects are modified by reference.
An object with the names altered by a prefix or suffix. For data.tables, these are returned invisibly.
stringr.tools::str_prefix()
which is used by these functions
(setnames)data.table::setattr()
(data.table::setnames)data.table::setattr()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.