vec2mat             package:multcompView             R Documentation

_C_o_n_v_e_r_t _a _v_e_c_t_o_r _w_i_t_h _h_y_p_h_e_n_a_t_e_d _n_a_m_e_s _i_n_t_o
_a _m_a_t_r_i_x.

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

     Convert a vector with hypehnated names into a symmetric matrix
     with names obtained from  vect2mat2(names(x)).

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

       vec2mat(x, sep="-")

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

       x: Either (1) a vector with hyphenated names indicating pairs of
          factor levels, groups or items that are and are not
          significantly different or (2) a matrix indicating same.  If
          x is already a matrix, it is checked for symmetry.  NAs are
          not allowed.   

     sep: "strsplit" character to apply to names(x).   

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

     x must have names each of which contains exactly one hyphen;  if
     not, vec2mat issues an error message. If the same comparison is
     present multiple times, the last value is used; no check is made
     for duplicates.

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

     A symmetrix matrix of the same class as the input with names
     obtained from unique(strsplit(names(x))).   All nonspecified
     elements will be 1 if class(x) is numeric, FALSE if logical and ""
     if character.  Used by the functions 'multcompLetters' and
     'multcompTs'.

_A_u_t_h_o_r(_s):

     Spencer Graves

_S_e_e _A_l_s_o:

     'multcompLetters' 'multcompTs'

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

     dif3 <- c(FALSE, FALSE, TRUE)
     names(dif3) <- c("a-b", "a-c", "b-c")
     vec2mat(dif3)

     dif3. <- 1:3
     names(dif3.) <- c("a-b", "a-c", "b-c")
     vec2mat(dif3.)

     dif.ch <- c("this",'is','it')
     names(dif.ch) <- c("a-b", "a-c", "b-c")
     vec2mat(dif.ch)

     vec2mat(array(1, dim=c(2,2)))
      

