tab2geo: Create a 'ggene' object from data frames

Description Usage Arguments Details Value Warning Author(s) See Also Examples

View source: R/tab2geo.R

Description

The function create a ggene object from a data frame containing the genetic data and a second data frame containing the coordinates.

Usage

1
tab2geo(X, coord)

Arguments

X

A data frame with the genetic data of a set of individuals. Locus in columns, individuals as rows.

coord

A data frame containing the coordinates of the individuals.

Details

tab2geo was written to handle haploid data which are not supported in the function gene2geo.

Value

An object of class ggene with 5 items:

tab

Data frame of the dummy variable coding for the presence of each allele. The number of rows is the number of individuals, the number of columns is the total number of alleles (all locus pooled).

coord

The x and y cordinates (longitude and latitude).

nloc

Number of different locus.

loc

The number of different alleles per locus.

locnames

The names of the different locus.

Warning

Caution is needed as regards missing data (NAs). NAs must be removed or replaced prior to analysing the dataset. One option developped in the package adegenet is to replace NAs by the NAs by the mean allele frequency. ggene has no function to handle NAs in raw data and users are referred to the package adegenet and its function scaleGen. This function will allow processing diploid data as a genind object. For haploid datasets, NAs removal must be done directly by users.

Author(s)

Jean-Pierre Rossi <[email protected]>

See Also

tab2geo

Examples

1
2
3
4
5
6
7
dat <- read.csv(system.file("extdata/sim_01.csv", package="ggene"),
 header=FALSE)
xy <- read.csv(system.file("extdata/xysim_01.csv", package="ggene"),
 header=FALSE)
data <- tab2geo(X=dat, coord=xy)
class(data)
str(data)

ggene documentation built on May 31, 2017, 4:17 a.m.