pop_gen_index: Compute population-level genetic indices

View source: R/pop_gen_index.R

pop_gen_indexR Documentation

Compute population-level genetic indices

Description

The function computes population-level genetic indices from an object of class genind.

Usage

pop_gen_index(x, pop_names = NULL, indices = c("Nb_ind", "A", "He", "Ho"))

Arguments

x

An object of class genind from package adegenet.

pop_names

(optional) A character vector indicating population names. It is of the same length as the number of populations. Without this argument, populations are given the names they have initially in the 'genind' object (which is sometimes only a number). The order of the population names must match with their order in the 'genind' object. The function does not reorder them. Users must be careful.

indices

(optional) A character vector indicating the population-level indices to compute. These indices can be:

  • Mean allelic richness by locus by population (indices = c("A", ...))

  • Mean expected heterozygosity by locus by population (indices = c("He",...))

  • Mean observed heterozygosity by locus by population (indices = c("Ho",...))

  • Number of individuals by population (indices = c("Nb_ind", ...))

  • Total allelic richness by population (indices = c("A_tot",...))

By default, indices = c("Nb_ind", "A", "He", "Ho").

Value

An object of class data.frame whose rows correspond to populations and columns to population attributes (ID, size, genetic indices). By default, the first column corresponds to the population names (ID). The order of the columns depends on the vector 'indices'.

Author(s)

P. Savary

Examples

data(data_ex_genind)
x <- data_ex_genind
pop_names <- levels(x@pop)
df_pop_indices <- pop_gen_index(x = x,
                   pop_names = pop_names,
                   indices = c("Nb_ind", "A"))

graph4lg documentation built on Feb. 16, 2023, 5:43 p.m.