Learn R Programming

dartR (version 2.9.9.5)

gl2dartR: Convert a genlight object to a dartR object

Description

This function converts a `genlight` object into a `dartR` object by changing its class attribute. It is used to convert legacy data sets to the new dartR format.

Usage

gl2dartR(x, filename = NULL, file.path = tempdir())

Value

The input object with class changed to `"dartR"` and its package attribute set to `"dartR.base"`.

Arguments

x

An object of class `genlight` to be converted.

filename

A character string specifying the name of the file to save the converted object. [default is gl.rds]

file.path

A character string specifying the path to save the file.

Examples

Run this code
simgl <- glSim(10, 100, ploidy = 2, indnames=1:10, locnames=1:100)  # Simulating a genlight object
simgl <- gl2dartR(simgl)
pop(simgl)<- rep("A",10)
indNames(simgl) <- paste0("ind",1:10)
gl.smearplot(simgl, verbose=0)

Run the code above in your browser using DataLab