cbind.genalex: Combine loci from class genalex data sets

Description Usage Arguments Details Value Note Author(s) See Also Examples

Description

Combine loci from class genalex data sets into one larger class genalex data set by adding loci. Locus counts are adjusted accordingly. The data sets must have the same ploidy, sample names and sample membership in populations. The order of the samples may differ, and the final data set will have the sample order of the first. Locus names must be unique across all data sets; if any locus names are duplicated, the genotypes are checked to assure they contain the exact same data and if so, the duplicate locus columns are ignored. Data set title and sample and population column headers are taken from the first data set unless supplied in the names argument. As subsequent data sets are added, they are compared against the aggregate data set assembled thus far, so a data set might have duplicate columns versus the aggregate that are not duplicates versus the first data set. See Details for how extra columns are handled.

Usage

1
cbind.genalex(..., names = NULL, deparse.level = 1)

Arguments

names

List of names: title for data set title, sample for sample column header, and pop for population column header. If names or any of its fields are not provided, the names of the first argument to ... are used.

deparse.level

Not used (yet)

...

All arguments must be class genalex data sets. If only one data set is supplied, it is returned unmodified.

Details

Extra columns are taken from the first data set. If the first data set does not have extra columns but others do, extra columns are assembled from data sets that have them. Columns with the same name in extra columns are dropped without checking contents. Columns with different names are added with cbind to the right of the existing set of extra columns.

Data sets must have the same number of rows, this is a necessary consequence of containing the same samples. Unlike the default cbind method, values will not be recycled to create matching row counts.

Value

Annotated data frame of class genalex. If names or any of its fields are not provided, the names of the first argument are used. The data.file.name attribute is a character representation of the call to cbind.

Note

If one of the arguments is not of class genalex, then this function will not be called, instead cbind.data.frame or perhaps another cbind method of base R will be called silently and will return an object that is not of class genalex. If this occurs, none of the special processing for class genalex objects will be applied and the result is probably not what you intended. If there is a chance you have mixed objects of different classes while calling this function, assure that the return value is class genalex by using is.genalex.

If you in fact want to add genotype data from a data frame or matrix to an object of class genalex, then use addLocus.

Author(s)

Douglas G. Scofield

See Also

genalex, cbind, rbind.genalex

Examples

1
2
3
4
5
6
7
gt1 <- data.frame(a = 11:13, a.2 = 14:16, b = 101:103, b.2 = 104:106)
x1 <- genalex(1:3, "snurf", gt1)
gt2 <- data.frame(c = 21:23, c.2 = 24:26, d = 201:203, d.2 = 204:206)
x2 <- genalex(1:3, "snurf", gt2)
x <- cbind(x1, x2)
x
attributes(x)

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