dimrename               package:memisc               R Documentation

_C_h_a_n_g_e _d_i_m_n_a_m_e_s, _r_o_w_n_a_m_e_s, _o_r _c_o_l_n_a_m_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     These functions provide an easy way to change the 'dimnames',
     'rownames' or 'colnames' of an array.

_U_s_a_g_e:

     dimrename(x, dim = 1, ..., gsub = FALSE, fixed = TRUE, warn = TRUE)
     rowrename(x, ..., gsub = FALSE, fixed = TRUE, warn = TRUE)
     colrename(x, ..., gsub = FALSE, fixed = TRUE, warn = TRUE)

_A_r_g_u_m_e_n_t_s:

       x: An array with dimnames

     dim: A vector that indicates the dimensions

     ...: A sequence of named arguments

    gsub: a logical value; if TRUE, 'gsub' is used to change the
          'dimnames' of the object. That is, instead of substituting
          whole names, substrings of the 'dimnames' of the object can
          changed. 

   fixed: a logical value, passed to 'gsub'. If TRUE, substitutions are
          by fixed strings and not by regular expressions.

    warn: logical; should a warning be issued if the pattern is not
          found?

_D_e_t_a_i_l_s:

     'dimrename' changes the dimnames of 'x' along dimension(s) 'dim'
     according to the remaining arguments. The argument names are the
     _old_ names, the values are the new names. 'rowrename' is a
     shorthand for changing the rownames, 'colrename' is a shorthand
     for changing the colnames of a matrix or matrix-like object.

     If 'gsub' is FALSE, argument tags are the _old_ 'dimnames', the
     values are the new 'dimnames'. If 'gsub' is TRUE, arguments are
     substrings of the 'dimnames' that are substituted by the argument
     values.

_V_a_l_u_e:

     Object 'x' with changed dimnames.

_E_x_a_m_p_l_e_s:

     m <- matrix(1,2,2)
     rownames(m) <- letters[1:2]
     colnames(m) <- LETTERS[1:2]
     m
     dimrename(m,1,a="first",b="second")
     dimrename(m,1,A="first",B="second")
     dimrename(m,2,"A"="first",B="second")

     rowrename(m,a="first",b="second")
     colrename(m,"A"="first",B="second")

