read.loci {pegas} | R Documentation |
This function reads allelic data from a text file: rows are individuals, and columns are loci and optional variables. By default, the first line of the file gives the locus names. If one column is labelled ``population'', it is taken as a population variable.
read.loci(file, header = TRUE, loci.sep = " ", allele.sep = "/", col.pop = "none", col.loci = NULL, ...)
file |
a file name specified by either a variable of mode character, or a quoted string. |
header |
a logical specifying whether the first line of the data
file gives the names of the loci (TRUE by default). |
loci.sep |
the character(s) separating the loci (columns) in the data file (a space by default). |
allele.sep |
the character(s) separating the alleles for each locus in the data file (a forward slash by default). |
col.pop |
specifies whether one of the column of the data file
identifies the population; default "none" , otherwise an
integer giving the number of the column. |
col.loci |
a vector of integers specifying the indices of the columns that are loci. By default, all columns are taken as loci except one labelled "population", if present. |
... |
further arguments passed to read.table . |
The rownames of the returned object identify the individual genotypes;
they are either taken from the data file if present, or given the
values "1"
, "2"
, ... Similarly for the colnames: if
absent in the file (in which case header = FALSE
must be set),
they are given the values "V1"
, "V2"
, ...
In the returned genotypes, alleles are separated by "/"
, even
if it is not the case in the data file.
The vignette ``Reading Genetic Data Files Into R with adegenet
and pegas'' explains how to read various file formats including
Excel files (type vignette("ReadingFiles")
in R).
A data frame with class c("loci", "data.frame")
. It is a data
frame with an attribute "locicol"
specifying the columns that
must be treated as loci. The latter are factors. The other columns can
be of any type.
Details on the structure can be found in
http://ape.mpl.ird.fr/pegas/DefinitionDataClassesPegas.pdf
Emmanuel Paradis
read.gtx
, write.loci
,
summary.loci