Used internally in radiator
and might be of interest for users.
The function tidy_fstat reads a file in the
fstat file (Goudet, 1995)
into a wide or long/tidy data frame
To manipulate and prune the dataset prior to tidying, use the functions
tidy_genomic_data and
genomic_converter, that uses blacklist and whitelist along
several other filtering options.
tidy_fstat(data, strata = NULL, tidy = TRUE, filename = NULL)A fstat
filename with extension .dat.
(optional) A tab delimited file with 2 columns. Header:
INDIVIDUALS and STRATA.
The STRATA column can be any hierarchical grouping.
To create a strata file see individuals2strata.
Default: strata = NULL.
(optional, logical) With tidy = FALSE,
the markers are the variables and the genotypes the observations (wide format).
With the default: tidy = TRUE, markers and genotypes are variables
with their own columns (long format).
(optional) The file name for the tidy data frame
written to the working directory.
Default: filename = NULL, the tidy data is
in the global environment only (i.e. not written in the working directory).
The output in your global environment is a wide or long/tidy data frame.
If filename is provided, the wide or long/tidy data frame is also
written to the working directory.
Goudet J. (1995). FSTAT (Version 1.2): A computer program to calculate F-statistics. Journal of Heredity 86:485-486
if (FALSE) { # \dontrun{
# We will use the fstat dataset provided with adegenet package
require("hierfstat")
# The simplest form of the function:
fstat.file <- radiator::tidy_fstat(
data = system.file(
"extdata/diploid.dat",
package = "hierfstat"
)
)
# To output a data frame in wide format, with markers in separate columns:
nancycats.wide <- radiator::tidy_fstat(
data = system.file(
"extdata/diploid.dat",
package = "hierfstat"
),
tidy = FALSE
)
} # }