Learn R Programming

dartR (version 0.80)

gl.collapse: Collapse a distance matrix by amalgamating populations

Description

This script takes a distance matrix (d in 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", t = 0, iter = 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 population reassignments arising from the amalgamation of populations [default tmp.csv]

t

-- the threshold distance value for amalgamating populations [default 0]

iter

-- a parameter to indicate the cycle when gl.collapse() is used interatively [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,], t=0.05)
gl <- gl.collapse(fd, testset.gl[1:20,], recode.table="testset_recode.csv",t=0.026)
# }

Run the code above in your browser using DataLab