makefamid              package:kinship              R Documentation

_I_d_e_n_t_i_f_y _f_a_m_i_l_y _g_r_o_u_p_s

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

     Given a set of parentage relationships, this subdivides a set of
     subjects into families.

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

     makefamid(id, father.id, mother.id)

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

      id: a vector of unique subject identifiers 

father.id : for each subject, the identifier of their biolgical father 

mother.id : for each subject, the identifier of thier biological mother 

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

     This function may be useful to create a family identifier if none
     exists in the data (rare), to check for anomalies in a given
     family identifier (see the 'familycheck' function), or to create a
     more space and time efficient kinship matrix by separating out
     marry-ins without children as 'unrelated'.

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

     a vector of family identifiers. Individuals who are not blood
     relatives of anyone else in the data set as assigned a family id
     of 0.

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

     'makefamid, kinship, makekinship'

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

     ## Not run: 
     > newid <- makefamid(cdata$gid, cdata$dadid, cdata$momid)
     > table(newid==0)
      FALSE TRUE 
      17859 8191
     # So nearly 1/3 of the individuals are not blood relatives.

     > kin1 <- makekinship(cdata$famid, cdata$gid, cdata$dadid, cdata$momid)
     > kin2 <- makekinship(newid, cdata$gid, cdata$dadid, cdata$momid, unique=0)
     > dim(kin2)
     [1] 26050 26050
     > dim(kin1)
     [1] 26050 26050

     > length(kin2@blocks)/length(kin1@blocks)
     [1] 0.542462
     # Basing kin1 on newid rather than cdata$famid (where marry-ins were each
     #   labeled as members of one of the 426 families) reduced its size by just
     #   less than half.
     ## End(Not run)

