rename                package:memisc                R Documentation

_C_h_a_n_g_e _N_a_m_e_s _o_f _a _N_a_m_e_d _O_b_j_e_c_t

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

     'rename' changes the names of a named object.

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

     rename(x, ..., gsub = FALSE, fixed = TRUE, warn = TRUE)

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

       x: Any named object

     ...: A sequence of named arguments, all of type character

    gsub: a logical value; if TRUE, 'gsub' is used to change the row
          and column labels of the resulting table. That is, instead of
          substituting whole names, substrings of the names 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: a logical value; should a warning be issued if those names to
          change are not found?

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

     This function changes the names of 'x' according to the remaining
     arguments. If 'gsub' is FALSE, argument tags are the _old_ names,
     the values are the new names. If 'gsub' is TRUE, arguments are
     substrings of the names that are substituted by the argument
     values.

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

     The object 'x' with new names defined by the ... arguments.

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

       x <- c(a=1, b=2)
       rename(x,a="A",b="B")
       
       str(rename(iris,
                       Sepal.Length="Sepal_Length",
                       Sepal.Width ="Sepal_Width",
                       Petal.Length="Petal_Length",
                       Petal.Width ="Petal_Width"
                       ))
       str(rename(iris,
                       .="_"
                       ,gsub=TRUE))

