Learn R Programming

nprcgenekeepr (version 3.0.0)

hasBothParents: Check whether an animal has both parents

Description

Check whether an animal has both parents

Usage

hasBothParents(id, ped)

Value

TRUE if ID has both sire and dam identified in ped, FALSE if one or both are unknown, and logical(0) if id is not in ped.

Arguments

id

a single ID to examine for parents. A vector of IDs is not supported: the result is not one value per ID, and a recycling warning appears only when the number of IDs does not divide the number of rows of ped.

ped

The pedigree information in data.frame format

Examples

Run this code
library(nprcgenekeepr)
ped <- nprcgenekeepr::pedOne
names(ped) <- c("id", "sire", "dam", "sex", "birth")
hasBothParents("o2", ped)
ped$sire[ped$id == "o2"] <- NA
hasBothParents("o2", ped)

Run the code above in your browser using DataLab