Learn R Programming

dartR (version 1.0)

gl.collapse: Collapse a distance matrix by amalgamating populations

Description

This script takes a distance matrix (d, lower matrix) and generates a population recode table to amalgamate populations with distance less than or equal to a specified threshold The distance matrix is generated by gl.fixed.diff()

Usage

gl.collapse(fd, gl, recode.table = "tmp.csv", tpop = 0, v = 1)

Arguments

fd

-- name of the distance matrix produced by gl.fixed.diff() [required]

gl

-- name of the genlight object from which the distance matrix was calculated [required]

recode.table

-- name of the new recode.table to receive the new population reassignments arising from the amalgamation of populations [default tmp.csv]

tpop

-- max number of fixed differences used amalgamating populations [default 0]

v

-- verbosity = 0, silent; 1, brief; 2, verbose [default 1]

Value

The new genlight object with recoded populations

Examples

Run this code
# NOT RUN {
#only used the first 20 individuals due to runtime reasons 
fd <- gl.fixed.diff(testset.gl[1:20,], tloc=0.05)
gl <- gl.collapse(fd, testset.gl, recode.table="testset_recode.csv",tpop=1)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab