Skip to contents

Adds a logical flag indicating whether a specified anchor individual appears anywhere in each person's ordered unilineal parental ancestor chain.

Usage

addParentalLineFlag(
  ped,
  anchor_id,
  flag_col,
  chain_col,
  component = c("dadID", "momID")
)

Arguments

ped

A pedigree data frame containing a parental chain list-column.

anchor_id

ID of the anchor individual to search for within each person's parental chain.

flag_col

Character string giving the name of the logical output column to add to `ped`.

chain_col

Character string giving the name of the list-column containing ordered parental ancestor chains.

component

Character string specifying which parental component the chain represents. Must be either `"dadID"` for paternal chains or `"momID"` for maternal chains.

Value

A data frame with `flag_col` added. The flag is `TRUE` when `anchor_id` appears in the individual's selected parental chain and `FALSE` otherwise.

Details

For `component = "dadID"`, the function searches the paternal chain. For `component = "momID"`, the function searches the maternal chain.

The anchor ID is coerced to character before comparison because the chain columns produced by [addParentalChain()] store graph vertex names as character values.

This function assumes that `chain_col` is a list-column in which each element is a character vector of ancestor IDs. Empty chains should be represented as `character(0)`.