glMean: Frequency of the second allele per locus, for dartR and...

View source: R/utils.dartR.class.def.r

glMeanR Documentation

Frequency of the second allele per locus, for dartR and genlight objects

Description

Returns, for each locus, the mean of the second (alternative) allele, ignoring missing data: with alleleAsUnit = TRUE, its frequency among the scored allele copies. It replaces adegenet::glMean so that FBM-backed dartR objects (see gl.gen2fbm) are handled; other objects are passed to adegenet::glMean and give identical results.

Usage

glMean(x, alleleAsUnit = TRUE)

Arguments

x

Name of the dartR or genlight object [required].

alleleAsUnit

If TRUE, the mean is taken over allele copies; if FALSE, over individuals, each genotype divided by the individual's ploidy [default TRUE].

Value

A named numeric vector with one value per locus. Loci with no data give NaN.

Author(s)

Author(s): Bernd Gruber. Custodian: Bernd Gruber – Post to https://groups.google.com/d/forum/dartr

Examples

head(glMean(testset.gl))
fbm.gl <- gl.gen2fbm(testset.gl, verbose = 0)
all.equal(glMean(fbm.gl), glMean(testset.gl))

dartR.base documentation built on Nov. 18, 2026, 9:06 a.m.