Skip to contents

A script to edit individual names in a genlight object, or to create a reassignment table taking the individual labels from a genlight object, or to edit existing individual labels in an existing recode_ind file.


  out.recode.file = NULL,
  outpath = tempdir(),
  recalc = FALSE,
  mono.rm = FALSE,
  verbose = NULL



Name of the genlight object for which individuals are to be relabelled [required].


Name of the file to output the new individual labels [optional].


Path where to save the output file [default tempdir(), mandated by CRAN].


Recalculate the locus metadata statistics [default TRUE].


Remove monomorphic loci [default TRUE].


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].


An object of class ('genlight') with the revised individual labels.


Renaming individuals may be required when there have been errors in labelling arising in the process from sample to DArT files. There may be occasions where renaming individuals is required for preparation of figures. Caution needs to be exercised because of the potential for breaking the 'chain of evidence' between the samples themselves and the analyses. Recoding individuals can also be done with a recode table (csv).

This script will input an existing recode table for editing 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 individual labels in the parent genlight object.

The script, having deleted individuals, 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.

Use outpath=getwd() or outpath='.' when calling this function to direct output files to your working directory.

The script returns a genlight object with the new individual labels and the recalculated locus metadata.


Custodian: Arthur Georges -- Post to


if (FALSE) {
gl <- gl.edit.recode.ind(
gl <- gl.edit.recode.ind(, out.recode.file='ind.recode.table.csv')