combine                package:Hmisc                R Documentation

_E_l_e_m_e_n_t _M_e_r_g_i_n_g

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

     Merges an object by the names of its elements.  Inserting elements
     in 'value' into 'x' that do not exists in 'x' and replacing
     elements in 'x' that exists in 'value' with 'value' elements if
     'protect' is false.

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

     combine(x, value, protect = FALSE, ...)

     combine(x, protect = FALSE, ...) <- value

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

       x: named list or vector 

   value: named list or vector 

 protect: logical; should elements in 'x' be kept instead of elements
          in 'value'? 

     ...: currently does nothing; included if ever want to make
          generic. 

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

     Charles Dupont

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

     'names'

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

     x <- 1:5
     names(x) <- LETTERS[x]

     y <- 6:10
     names(y) <- LETTERS[y-2]

     x                  # c(A=1,B=2,C=3,D=4,E=5)
     y                  # c(D=6,E=7,F=8,G=9,H=10)

     combine(x, y)      # c(A=1,B=2,C=3,D=6,E=7,F=8,G=9,H=10)
     combine(x, y, protect=TRUE)      # c(A=1,B=2,C=3,D=4,E=5,F=8,G=9,H=10)

