Learn R Programming

pedtricks (version 0.4.2)

fix_ped: Manipulating pedigrees to prepare them for requirements of subsequent analyses Prepares a pedigree to conform with requirements of many softwares used in quantitative genetic analysis, as well as for many of the functions in pedtricks.

Description

Manipulating pedigrees to prepare them for requirements of subsequent analyses Prepares a pedigree to conform with requirements of many softwares used in quantitative genetic analysis, as well as for many of the functions in pedtricks.

Usage

fix_ped(ped, dat = NULL)

Value

Returns a pedigree in which all individuals that exist in the dam and sire columns are represented by their own record lines, occurring before the records of their first offspring. If data are supplied, then fix_ped will return a dataframe, the first three columns are the 'fixed' pedigree, and the following columns of which contain appropriately reordered data.

Arguments

ped

An ordered pedigree with 3 columns: id, dam, sire

dat

An optional data frame, the same length as the pedigree

Examples

Run this code
##  a valid pedigree, i.e., no loops, no bisexuality, etc.,
## but where not all parents have a record line, and where
## parents do not necessarily occur before their offspring:
pedigree <- as.data.frame(matrix(c(
  10, 1, 2,
  11, 1, 2,
  12, 1, 3,
  13, 1, 3,
  14, 4, 5,
  15, 6, 7,
  4, NA, NA,
  5, NA, NA,
  6, NA, NA,
  7, NA, NA
), 10, 3, byrow = TRUE))
names(pedigree) <- c("id", "dam", "sire")
pedigree
fixed_pedigree <- fix_ped(ped = pedigree)
fixed_pedigree

Run the code above in your browser using DataLab