as.genalex: Convert object to class genalex

Description Usage Arguments Value Author(s) See Also Examples

Description

Converts object x to a data frame of class genalex. There are seven cases:

If the object is not originally of class genalex, the "data.file.name" attribute will reflect this function call.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## S3 method for class 'genalex'
as.genalex(x, force = FALSE, ...)

## S3 method for class 'data.frame'
as.genalex(x, names = NULL, ploidy = 2, ...)

## S3 method for class 'loci'
as.genalex(x, sep = "/", pop, ...)

## Default S3 method:
as.genalex(x, ...)

Arguments

x

An object of class genalex or class 'data.frame'

force

If TRUE, check for consistency between data and annotations in x and recalculate and reset any inconsistent attributes. This option is only used if x has class genalex, and is FALSE by default.

names

A list of names to apply as accepted by genalex. If any names are not provided, they are taken from the names of the corresponding columns of x. This option is only used if x does not have class genalex.

ploidy

Ploidy of the genotype columns in x (x[, 3:ncol(x)]). This option is only used if x does not have class genalex.

sep

Character separating joined alleles, if converting from object of class 'loci'

pop

Populations to assign to samples if there is no population column in the data

...

Additional arguments, ignored unless x is of class 'loci' and if so passed to genalex

Value

x converted to a class genalex object

Author(s)

Douglas G. Scofield

See Also

is.genalex, genalex, splitGenotypes

Examples

1
2
3
4
5
data(Qagr_adult_genotypes)
gt <- as.genalex(Qagr_adult_genotypes)
cat(attr(gt, "data.file.name"), "\n")
gt.2 <- as.genalex(as.data.frame(Qagr_adult_genotypes))
cat(attr(gt.2, "data.file.name"), "\n")

douglasgscofield/readGenalex documentation built on May 15, 2019, 10:43 a.m.