Learn R Programming

dartR (version 1.1.11)

gl.edit.recode.pop: Create or edit a population re-assignment table

Description

A script to edit population assignments in a genlight object, or to create a reassignment table taking the population assignments from a genlight object, or to edit existing population assignments in a pop.recode.table.

Usage

gl.edit.recode.pop(gl, pop.recode = NULL, recalc = FALSE,
  mono.rm = TRUE, v = 1)

Arguments

gl

Name of the genlight object for which populations are to be reassigned.[required]

pop.recode

Name of the file to output the new assignments [optional]

recalc

-- Recalculate the locus metadata statistics if any individuals are deleted [default TRUE]

mono.rm

-- Remove monomorphic loci [default TRUE]

v

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

Value

An object of class ("genlight") with the revised population assignments

Details

Genlight objects assign specimens to populations based on information in the ind.metadata file provided when the genlight object is first generated. Often one wishes to subset the data by deleting populations or to amalgamate populations. This can be done with a pop.recode table with two columns. The first column is the population assignment in the genlight object, the second column provides the new assignment.

This script will input an existing reassignment table for editting and optionally save it as a new table, or if the name of an input table is not supplied, will generate a table using the population assignments in the parent genlight object.

The script, having deleted populations, optionally identifies resultant monomorphic loci or loci with all values missing and deletes them (using gl.filter.monomorphs.r). The script also optionally recalculates statistics made redundant by the deletion of individuals from the dataset.

The script returns a genlight object with the new population assignments and the recalculated locus metadata.

Examples

Run this code
# NOT RUN {
gl <- gl.edit.recode.pop(testset.gl)
# }

Run the code above in your browser using DataLab