mergeList             package:ifultools             R Documentation

_M_e_r_g_e_s _t_h_e _i_n_f_o_r_m_a_t_i_o_n _f_r_o_m _t_w_o _l_i_s_t_s

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

     Given lists X and Y, this functions replaces the commonly named
     objects in X with those of Y and appends the uncommon Y components
     to X. List X is returned as the merged list.

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

     mergeList(x, y)

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

       x: a list of named objects.

       y: a list of named objects.

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

     'prettyPrintList'.

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

     ## develop lists 
     dinner <- list(Entree="Spaghetti and Meatballs",
         Starter="Caesar Salad", Dessert="Spumoni",
         Beverage="Wine and Water")

     ## oops, we are all out of spumoni and we just got 
     ## some tiramisu in from the local bakery 
     change <- list(Dessert="Tiramisu",Note="Please tip your waiter")

     ## merge the lists and prett-print 
     prettyPrintList(mergeList(dinner, change), header="What's for dinner?")

