Learn R Programming

dartR.base (version 1.0.5)

gl.join: Combines two dartR genlight objects

Description

This function combines two genlight objects and their associated metadata. The history associated with the two genlight objects is cleared from the new genlight object. The individuals/samples must be the same in each genlight object. The function is typically used to combine datasets from the same service where the files have been split because of size limitations. The data is read in from multiple csv files, then the resultant genlight objects are combined. This function works with both SNP and Tag P/A data.

Usage

gl.join(x1, x2, method = "sidebyside", verbose = NULL)

Value

A new genlight object

Arguments

x1

Name of the first genlight object [required].

x2

Name of the first genlight object [required].

method

If method='sidebyside' then combine the two by bringing the loci together against the same set of individuals; If method='end2end' then combine the two by bringing two sets of individuals together against the same set of loci [default 'sidebyside']

verbose

Verbosity: 0, silent or fatal errors; 1, begin and end; 2, progress log; 3, progress and results summary; 5, full report [default 2 or as specified using gl.set.verbosity].

Author

Custodian: Arthur Georges -- Post to https://groups.google.com/d/forum/dartr

Details

This script joins two genlight objects together along with the associated metadata. if method='sidebyside' (the default), the individuals in the two genlight objects must be the same and in the same order. The loci are combined.

If method='end2end', the loci in the two genlight objects must be the same and in the same order. The data for the two sets of individuals are combined. Note that if two individuals have the same names, they will be made unique.#'

See Also

Other data manipulation: gl.define.pop(), gl.drop.ind(), gl.drop.loc(), gl.drop.pop(), gl.edit.recode.pop(), gl.impute(), gl.keep.ind(), gl.keep.loc(), gl.keep.pop(), gl.make.recode.ind(), gl.merge.pop(), gl.reassign.pop(), gl.recode.ind(), gl.recode.pop(), gl.rename.pop(), gl.sample(), gl.sim.genotypes(), gl.sort(), gl.subsample.ind(), gl.subsample.loc()

Examples

Run this code
x1 <- testset.gl[,1:100]
x1@other$loc.metrics <-  testset.gl@other$loc.metrics[1:100,]
nLoc(x1)
x2 <- testset.gl[,101:150]
x2@other$loc.metrics <-  testset.gl@other$loc.metrics[101:150,]
nLoc(x2)
gl <- gl.join(x1, x2, verbose=2)
nLoc(gl)

x1 <- testset.gl[,1:100]
x1@other$loc.metrics <-  testset.gl@other$loc.metrics[1:100,]
nLoc(x1)
x2 <- testset.gl[,1:100]
x2@other$loc.metrics <-  testset.gl@other$loc.metrics[1:100,]
nLoc(x2)
gl <- gl.join(x1, x2, method="end2end", verbose=2)
nInd(gl)

Run the code above in your browser using DataLab