Description Usage Arguments Value Author(s)
rename is a generic function for renaming elements, rows or columns
1 | rename(x, oldnames, newnames, which.dim, sanity = T)
|
x |
a vector or list with named elements, or a data.frame, matrix or array with named rows, columns, pages, etc. |
oldnames |
character vector with names of the elements, rows or columns to be renamed. All names must be unique. Partial matching is NOT supported. An error will be generated if any oldnames are not found in x, or if they may specify more than one element (for example, if both a row and column share the same name, and which.dim was not specified.) The elements to be renamed may be in any order, and may come from multiple dimensions (e.g., a mix of row and column names). |
newnames |
character vector of unique replacement names for corresponding elements of oldnames. Must be the same length as oldnames. |
which.dim |
integer or character string specifying which dimension of x where names should be replaced. Ignored if x is a vector or list. If omitted, all names returned by dimnames(x) will be considered candidates for replacement, but will only be replaced if a unique match is found. |
sanity |
logical; if true, a table summarizing the replacements is printed to the screen. |
Returns the object x with elements, rows or columns renamed as specified. Note that you must reassign the variable to this value if you want the new names to take effect.
M.W.Rowe, mwr.stats@gmail.com
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.