Description Usage Arguments Details Functions Note Examples
View source: R/array_transform.R
recodeDimnames renames dimension identifiers and dimension levels
(useful before plotting). recodeDimnames_ does the same in place, 
thus without making any copy.
1 2 3  | recodeDimnames(dat, dim_levels = NULL, dim_ids = NULL)
recodeDimnames_(dat, dim_levels = NULL, dim_ids = NULL)
 | 
dat | 
 an array with dimension names  | 
dim_levels | 
 a named list of named character vectors. The name of the list element identifies the dimension, the names of the character vector refer to the original dimension levels, and the values of the character vector correspond to the new dimension levels. See also Details.  | 
dim_ids | 
 a named character vector which is used to rename the dimension identifiers  | 
recodeDimnames goes through the 'dim_levels' argument first.
If a character vector in 'dim_levels' is not named, it must be of the same
length as the length of the given dimension.
recodeDimnames_: Modify by reference
Use recodeDimnames_ with extra care because it modifies in place
all objects which 'dat' refers to.
1 2 3 4 5 6 7 8 9 10 11 12 13  | ## load example data
data(erps)
## recode the 'subst', 'ident', and 'transp' levels of the 'stimclass' 
## dimension to 'Substitution', 'Identical', and 'Transposition', 
## respectively; also rename the 'stimclass' dimension name to 
## 'Stimulus class'
erps2 <- recodeDimnames(erps, 
                        list(stimclass = c(subst = "Substitution",
                                           ident = "Identical",
                                           transp = "Transposition")),
                        c(stimclass = "Stimulus class"))
 
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.