extend {GeneticsPed} | R Documentation

## Extend pedigree

### Description

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

### Usage

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

### Arguments

`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

### Details

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`.

### Value

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.

### Author(s)

Gregor Gorjanc

### See Also

`Pedigree`, `family`, geneticGroups???

### Examples

      # --- 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))

[Package GeneticsPed version 1.50.0 Index]