count_and_plot_mate_distribution: Count and plot the number of mates each individuals has...

View source: R/count_and_plot_mate_distribution.R

count_and_plot_mate_distributionR Documentation

Count and plot the number of mates each individuals has produced offspring with

Description

This just tallies up the information from the pedigree. It will plot things faceted by pop (over rows) and sexes (over columns).

Usage

count_and_plot_mate_distribution(P)

Arguments

P

the pedigree from the simulation, like that returned in the pedigree component of the list returned by slurp_spip().

Value

A list with two components with names:

  • mate_counts: A tibble with information about the number of mates with which a parent produced offspring each year. It has the columns:

    • sex: the sex of this parent

    • year: the year during which the mating occurred

    • pop: the population this parent was in

    • parent: the ID of the parent

    • num_offs: the number of offspring this parent had in total

    • num_mates: the number of mates this parent had

  • plot_mate_counts: a ggplot object, faceted on a grid by population in columns and sex in rows. The x-axis is the number of offspring (in a season), the y-axis is the number of mates in a season, and the fill color of the grid gives the number of parents with that number of offspring and mates.

Examples

result <- count_and_plot_mate_distribution(three_pops_no_mig_slurped_results$pedigree)

# have a look at the results:
result$mate_counts

result$plot_mate_counts


eriqande/CKMRpop documentation built on Jan. 25, 2024, 2:10 p.m.