Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

genind2df

Convert a genind object to a data.frame.


Description

The function genind2df converts a genind back to a data.frame of raw allelic data.

Usage

genind2df(x, pop = NULL, sep = "", usepop = TRUE, oneColPerAll = FALSE)

Arguments

x

a genind object

pop

an optional factor giving the population of each individual.

sep

a character string separating alleles. See details.

usepop

a logical stating whether the population (argument pop or x@pop should be used (TRUE, default) or not (FALSE)).

oneColPerAll

a logical stating whether or not alleles should be split into columns (defaults to FALSE). This will only work with data with consistent ploidies.

Value

a data.frame of raw allelic data, with individuals in rows and loci in column

Author(s)

Thibaut Jombart t.jombart@imperial.ac.uk

See Also

Examples

## simple example
df <- data.frame(locusA=c("11","11","12","32"),
locusB=c(NA,"34","55","15"),locusC=c("22","22","21","22"))
row.names(df) <- .genlab("genotype",4)
df

obj <- df2genind(df, ploidy=2, ncode=1)
obj
obj@tab


## converting a genind as data.frame
genind2df(obj)
genind2df(obj, sep="/")

adegenet

Exploratory Analysis of Genetic and Genomic Data

v2.1.3
GPL (>= 2)
Authors
Thibaut Jombart [aut] (<https://orcid.org/0000-0003-2226-8692>), Zhian N. Kamvar [aut, cre] (<https://orcid.org/0000-0003-1458-7108>), Caitlin Collins [ctb], Roman Lustrik [ctb], Marie-Pauline Beugin [ctb], Brian J. Knaus [ctb], Peter Solymos [ctb], Vladimir Mikryukov [ctb], Klaus Schliep [ctb], Tiago Maié [ctb], Libor Morkovsky [ctb], Ismail Ahmed [ctb], Anne Cori [ctb], Federico Calboli [ctb], RJ Ewing [ctb], Frédéric Michaud [ctb], Rebecca DeCamp [ctb], Alexandre Courtiol [ctb] (<https://orcid.org/0000-0003-0637-2959>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.