Compute and Label Pairwise Relationships Across Multiple Family Graphs
Source:R/Labelling_and_plotting_functions.R
get_relations.RdApplies get_generations() and label_relatives() to a tibble of
family graph objects from get_family_graphs(), returning a unified table of labelled pairwise relationships
for all individuals across the specified families.
Usage
get_relations(
family_graphs,
fid = "fid",
family_id_vec = NULL,
fam_graph_col = "fam_graph"
)Arguments
- family_graphs
A tibble containing family-specific graph objects from
get_family_graphs()(typically of classigraph). Each row should correspond to a distinct family, with one column containing the graph object and another containing the family identifier (typically the proband's id).- fid
A character string specifying the name of the column in
family_graphsthat holds the family identifiers. Defaults to"fid".- family_id_vec
An optional character or numeric vector specifying which families to process. If
NULL(default), the function will process all families infamily_graphs.- fam_graph_col
A character string specifying the name of the column in
family_graphsthat contains the family graph objects. Defaults to"fam_graph".
Value
A tibble containing all labelled pairwise relationships across the specified families, with columns:
- fid
Family identifier (typically the proband's id).
- id1, id2
Identifiers for the two individuals being compared.
- gen.x, gen.y
Number of generations separating each individual from their most recent common ancestor.
- k
Kinship coefficient between the pair.
- lab
Relationship label (e.g.,
"S","P","GP","1C","HNib").
See also
get_generations() for computing generational distances and kinship coefficients,
label_relatives() for labelling relationships based on generational patterns.