pop_gen_index: Compute population-level genetic indices

View source: R/pop_gen_index.R

pop_gen_indexR Documentation

Compute population-level genetic indices


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


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



An object of class genind from package adegenet.


(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.


(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").


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'.


P. Savary


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 May 18, 2022, 5:09 p.m.