Learn R Programming

hierfstat (version 0.5-11)

read.fstat: Reads data from a FSTAT file

Description

Imports a FSTAT data file into R. The data frame created is made of nl+1 columns, nl being the number of loci. The first column corresponds to the Population identifier, the following columns contains the genotypes of the individuals.

Usage

read.fstat(fname, na.s = c("0","00","000","0000","00000","000000","NA"))

Arguments

fname

a file in the FSTAT format (http://www.unil.ch/popgen/softwares/fstat.htm): The file must have the following format:

The first line contains 4 numbers: the number of samples, np , the number of loci, nl, the highest number used to label an allele, nu, and a 1 if the code for alleles is a one digit number (1-9), a 2 if code for alleles is a 2 digit number (01-99) or a 3 if code for alleles is a 3 digit number (001-999). These 4 numbers need to be separated by any number of spaces.

na.s

The strings that correspond to the missing value. You should note have to change this

Value

a data frame containing the desired data, in a format adequate to pass to varcomp

References

Goudet J. (1995). FSTAT (Version 1.2): A computer program to calculate F- statistics. Journal of Heredity 86:485-486

Goudet J. (2005). Hierfstat, a package for R to compute and test variance components and F-statistics. Molecular Ecology Notes. 5:184-186

Examples

Run this code
# NOT RUN {
read.fstat(paste(path.package("hierfstat"),"/extdata/diploid.dat",sep="",collapse=""))
# }

Run the code above in your browser using DataLab