extend              package:GeneticsPed              R Documentation

_E_x_t_e_n_d _p_e_d_i_g_r_e_e

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

     'extend' finds ascendants, which do not appear as individuals in
     pedigree and assigns them as individuals with unknown ascendants
     in extended pedigree.

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

     extend(x, ascendant=NULL, col=NULL, top=TRUE)

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

       x: pedigree object

ascendant: character, column names of ascendant(s), see details

     col: character, column name(s) of attribute(s), see details

     top: logical, add ascendants as individuals on the top or bottom
          of the pedigree

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

     Argument 'ascendant' can be used to define, which ascendants will
     be extended. If 'ascendant=NULL', which is the default, all
     ascendant columns in the pedigree are used. The same approach is
     used with other pedigree attributes such as sex, generation, etc.
     with argument 'col'. Use 'col=NA', if none of the pedigree
     attributes should be extended.

     Sex of new individuals is infered from attribute 'ascendantSex'
     as used in 'Pedigree' function. Generation of new individuals is
     infered as minimal ('generationOrder="increasing"') or maximal
     ('generationOrder="decreasing"') generation value in descendants -
     1. See 'Pedigree' on this issue. Family values are extended with
     means of 'family'.

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

     Extended pedigree, where all ascendants also appear as individuals
     with unknown ascendants and infered other attributes such as sex,
     generation, etc. if this attributes are in the pedigree.

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

     Gregor Gorjanc

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

     'Pedigree', 'family', geneticGroups???

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

       # --- Toy example ---
       ped <- generatePedigree(nId=5, nGeneration=4, nFather=1, nMother=2)
       ped <- ped[10:20,]
       ped[5, "father"] <- NA # to test robustnes of extend on NA
       extend(ped)
       extend(ped, top=FALSE)

       ## Extend only ascendant and their generation
       extend(ped, col="generation")
       extend(ped, col=c("generation", "sex"))

       # --- Bigger example ---
       ped <- generatePedigree(nId=1000, nGeneration=10, nFather=100,
                               nMother=500)
       nrow(ped)
       # Now keep some random individuals
       ped <- ped[unique(sort(round(runif(n=nrow(ped)/2, min=1,
                                          max=nrow(ped))))), ]
       nrow(ped)
       nrow(extend(ped))

