Every genetic statistic in corridoR works from allele counts per
population and locus. A popcounts object holds them: a list with one
integer matrix per locus (populations in rows, alleles in columns), plus the
population names and the number of individuals sampled in each.
Usage
as_popcounts(x, ...)
# S3 method for class 'popcounts'
as_popcounts(x, ...)
# S3 method for class 'genind'
as_popcounts(x, pop = NULL, ...)
# S3 method for class 'genpop'
as_popcounts(x, ...)
# S3 method for class 'genlight'
as_popcounts(x, pop = NULL, ...)
# S3 method for class 'vcfR'
as_popcounts(x, pop = NULL, ...)Arguments
- x
An object to convert.
- ...
Not used.
- pop
Population of each individual, for objects that do not carry it (a
vcfRobject, or agenlightwithoutpop). Seeread_genotypes()for the accepted forms.
Details
as_popcounts() converts objects from other packages: genind, genpop
and genlight from adegenet and vcfR from vcfR. To read a file
directly, use read_genotypes().
Examples
ex <- corridor_example()
pc <- read_genotypes(ex$files$small)
pc
#> <popcounts> 6 populations, 100 loci (1-2 alleles per locus)
#> individuals per population: 8-8
#> populations: M03_01, M15_01, M28_01, M41_01, M55_01, M70_01