Learn R Programming

dartR.base (version 1.0.5)

gl.add.indmetrics: Adds metadata into a genlight object

Description

This function adds the metadata information to the slot ind.metrics and populates population and coordinates information slots if the they are found in the metadata.

Usage

gl.add.indmetrics(x, ind.metafile, verbose = NULL)

Value

A genlight object with metadata information for each individual.

Arguments

x

Name of the genlight object containing the SNP data, or the genind object containing the SilocoDArT data [required].

ind.metafile

path and name of CSV file containing the metadata information for each individual (see details for explanation) [required].

verbose

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

Author

Custodian: Luis Mijangos -- Post to https://groups.google.com/d/forum/dartr

Details

The ind.metadata file needs to have very specific headings. First a column with a heading named 'id'. Here the ids must match the ids in the genlight object, e.g. indNames(your_genlight). The following column headings are optional:

  • 'pop' - specifies the population membership of each individual.

  • 'lat' - latitude coordinates (in decimal degrees WGS1984 format).

  • 'lon' - longitude coordinates (in decimal degrees WGS1984 format).

Additional columns with individual metadata can be imported (e.g. age, sex, etc).

Examples

Run this code
dartfile <- system.file('extdata','testset_SNPs_2Row.csv', package='dartR.data')
metadata <- system.file('extdata','testset_metadata.csv', package='dartR.data')
gl <- gl.read.dart(dartfile, probar=TRUE)
gl <- gl.add.indmetrics(gl, ind.metafile = metadata)

Run the code above in your browser using DataLab