createAlleleTables: Generate an allele_divtables object from a class genalex...

Description Usage Arguments Details Value Note Examples

View source: R/allele_divtables-class.R

Description

S3 method to convert an object of class genalex to an object of class allele_divtables. a list of divtable objects representing sites-by-allele counts. This is an S3 generic so that other methods might be written to convert other genetic formats.

Usage

1
2
3
4
5
6
7
8
9
## Default S3 method:
createAlleleTables(x, ...)

## S3 method for class 'allele_divtables'
createAlleleTables(x, ...)

## S3 method for class 'genalex'
createAlleleTables(x, exclude = c(NA, "0"), quiet = TRUE,
  ...)

Arguments

x

Object of class genalex holding genotypes to be converted, or of a class and format that can be converted to genalex using as.genalex

exclude

Values in x that indicate missing alleles, these are excluded from the divtable entries for each locus

quiet

If TRUE, report the number of missing alleles excluded

Details

If x is not of class genalex, an attempt is made to convert it to class genalex using as.genalex from the readGenalex package. An error will be produced if x is of a class or format that cannot be converted to class genalex.

Another option for converting genotypes to allele_divtables objects is to convert to one of the formats recognised by as.genalex.

Although missing alleles may be common in genotypic data, there is no provision in diversity and other functions in this package for missing data. Missing alleles are recognised and excluded if they match one of the values in exclude. The numbers of missing alleles recognised is reported if quiet = FALSE.

Value

Object of class allele_divtable

Note

as.allele_divtables is a synonym, unless x is of class list. If so, if the class of each element of x is of class divtable, then the class of x is changed to allele_divtable. If x is of class allele_divtables it is returned unchanged.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Use genotype data from readGenalex package, already loaded
data(Qagr_pericarp_genotypes)
pal <- createAlleleTables(Qagr_pericarp_genotypes)
str(pal)

## The divtable for the first locus
pal[[1]]

## allele_divtables removes and can report missing data
data(Qagr_adult_genotypes)
aal <- createAlleleTables(Qagr_adult_genotypes, quiet = FALSE)

douglasgscofield/dispersalDiversity documentation built on March 30, 2021, 9:50 a.m.