This function converts the genetic data of an ecogen object
in a SPAGeDi input file.
When distance classes are required, they can be constructed by combining
the parameters "int", "smin", "smax", "nclass", "seqvec" and "size", as
described in the function eco.lagweight
.
A distance matrix can also be included using the "distmat" parameter.
Missing data must be coded as a single "NA" in the G data frame.
ecogen2spagedi(eco, pop = NULL, ndig, dir = "", outName = "infile.spagedi.txt", smin = 0, smax = NULL, int = NULL, nclass = NULL, seqvec = NULL, size = NULL, bin = c("sturges", "FD"), distmat = NULL, latlon = FALSE)
eco | Object of class "ecogen". |
---|---|
pop | The name of the S slot column with the groups for the output data. The default option includes all the individuals into a single group. |
ndig | Number of digits coding each allele (e.g., 1: x, 2: xx, or 3: xxx). |
dir | output path. Default = "" (current directory). |
outName | The name of the output file. |
smin | Minimum class distance in the units of the XY slot data. |
smax | Maximum class distance in the units of the XY slot data. |
int | Distance interval in the units of the XY slot data. |
nclass | Number of classes. |
seqvec | Vector with breaks in the units of the XY slot data. |
size | Number of individuals per class. |
bin | Rule for constructing intervals when a partition parameter (int, nclass or size) is not given. Default is Sturge's rule (Sturges, 1926). Other option is Freedman-Diaconis method (Freedman and Diaconis, 1981). |
distmat | Distance matrix to include (optional). |
latlon | Are the coordinates in decimal degrees format? Defalut FALSE. If TRUE,
the coordinates must be in a matrix/data frame with the longitude in the first
column and latitude in the second. The position is projected onto a plane in
meters with the function |
Freedman D., and P. Diaconis. 1981. On the histogram as a density estimator: L 2 theory. Probability theory and related fields, 57: 453-476.
Hardy O. and X Vekemans. 2002. SPAGeDi: a versatile computer program to analyse spatial genetic structure at the individual or population levels. Molecular ecology notes, 2: 18-620.
Sturges H. 1926. The choice of a class interval. Journal of the American Statistical Association, 21: 65-66.
# NOT RUN { data(eco.test) ecogen2spagedi(eco, dir = "", pop = "pop", ndig = 1,int=2, smax=6, outName="infile.spagedi.txt") # }