View source: R/calcConnectionsHelpers.R
getMidpoints | R Documentation |
A flexible utility function to compute x and y midpoints for groups of individuals using a specified method. Used to support positioning logic for sibling groups, parental dyads, or spousal pairs in pedigree layouts.
getMidpoints(
data,
group_vars,
x_vars,
y_vars,
x_out,
y_out,
method = "mean",
require_non_missing = group_vars
)
data |
A 'data.frame' containing the coordinate and grouping variables. |
group_vars |
Character vector. Names of the grouping variables. |
x_vars |
Character vector. Names of the x-coordinate variables to be averaged. |
y_vars |
Character vector. Names of the y-coordinate variables to be averaged. |
x_out |
Character. Name of the output column for the x-coordinate midpoint. |
y_out |
Character. Name of the output column for the y-coordinate midpoint. |
method |
Character. Method for calculating midpoints. Options include:
|
require_non_missing |
Character vector. Names of variables that must not be missing for the row to be included. |
A 'data.frame' grouped by 'group_vars' with new columns 'x_out' and 'y_out' containing midpoint coordinates.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.