| pedgenint | R Documentation |
Computes the generation intervals for the four gametic pathways: Sire to Son (SS), Sire to Daughter (SD), Dam to Son (DS), and Dam to Daughter (DD). The generation interval is defined as the age of the parents at the birth of their offspring.
pedgenint(
ped,
timevar = NULL,
unit = c("year", "month", "day", "hour"),
format = NULL,
cycle = NULL,
by = NULL
)
ped |
A |
timevar |
Character. The name of the column containing the birth date (or hatch date) of each individual. The column must be one of:
If |
unit |
Character. Output time unit for the interval:
|
format |
Character. Optional format string for parsing |
cycle |
Numeric. Optional target (designed) length of one generation
cycle expressed in
where |
by |
Character. Optional grouping column (e.g., |
Parent-offspring pairs with zero or negative intervals are excluded from
the calculation because they typically indicate data entry errors or
insufficient time resolution. If many zero intervals are expected (e.g.,
when using unit = "year" with annual spawners), consider using a
finer time unit such as "month" or "day".
Numeric year columns (e.g., 2020) are automatically converted to
Date by appending "-07-01" (mid-year) as a reasonable default.
For more precise results, convert to Date before calling this function.
A data.table with columns:
Group: Grouping level (if by is used).
Pathway: One of "SS", "SD", "DS", "DD",
"SO", "DO", or "Average".
SS/SD/DS/DD require offspring sex; SO (Sire-Offspring) and DO (Dam-Offspring)
are computed from all parent-offspring pairs regardless of offspring sex.
N: Number of parent-offspring pairs used.
Mean: Average generation interval in unit.
SD: Standard deviation of the interval.
GenEquiv: (Optional) Generation equivalents based on cycle.
# ---- Basic usage with package dataset (numeric Year auto-converted) ----
tped <- tidyped(big_family_size_ped)
gi <- pedgenint(tped, timevar = "Year")
gi
# ---- Generation equivalents with cycle ----
gi2 <- pedgenint(tped, timevar = "Year", cycle = 2)
gi2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.