pedSetBase {AlphaPart}R Documentation

pedSetBase.R

Description

A function to set the base population in the pedigree.

Usage

pedSetBase(
  x,
  keep = NULL,
  unknown = NA,
  report = TRUE,
  colId = 1,
  colFid = 2,
  colMid = 3
)

Arguments

x

data.frame , with (at least) the following columns: individual, father, and mother identification, and year of birth; see arguments colId, colFid, colMid, and colBY

keep

Logical, indicator that defines which individuals should stay in the the pedigree; see details.

unknown

Value used to represent unknown/missing identification

report

Logical, report success.

colId

Numeric or character, position or name of a column holding individual identification.

colFid

Numeric or character, position or name of a column holding father identification.

colMid

Numeric or character, position or name of a column holding mother identification.

Details

Base population in the pedigree is set by removing rows for some individuals, while their presence as parents is also removed.

Arguments down and na.rm allow for repeated use of this function, i.e., with down=FALSE and with down=TRUE (both in combination with na.rm=TRUE) in order to propagate information over the pedigree until "convergence".

This function can be very slow on large pedigrees with extensive missingness of birth years.

Value

Object x with removed rows for some individuals and their presence as parents. If report=TRUE progress is printed on the screen.

See Also

orderPed in pedigree package

Examples

## Example pedigree
ped <- data.frame(      id=1:10,
                       fid=c(0, 0, 0, 1, 1, 1, 3, 3, 3, 5),
                       mid=c(0, 0, 0, 2, 0, 2, 2, 2, 5, 0),
                  birth_dt=c(0, 0, 1, 2, 3, 3, 3, 4, 4, 5) + 2000)

## Set base population as those individuals that were born after year 2002
pedSetBase(x=ped, keep=ped$birth_dt > 2002, unknown=0)


[Package AlphaPart version 0.9.8 Index]