Export data from genind objects to genalex formatted \*.csv files.
Source:R/file_handling.r
genind2genalex.Rd
genind2genalex will export a genclone or genind object to a \*.csv file formatted for use in genalex.
Usage
genind2genalex(
gid,
filename = "",
overwrite = FALSE,
quiet = FALSE,
pop = NULL,
allstrata = TRUE,
geo = FALSE,
geodf = "xy",
sep = ",",
sequence = FALSE
)
Arguments
- gid
- filename
a string indicating the name and/or path of the file you wish to create. If this is left unchanged, the results will be saved in a temporary file and a warning will be displayed for six seconds before the file is written. This process should give you time to cancel the process and choose a file path. Otherwise, the name of the file is returned, so you can copy that to a file of your choice with
file.copy()
- overwrite
logical
ifFALSE
(default) andfilename
exists, then the file will not be overwritten. Set this option toTRUE
to overwrite the file.- quiet
logical
IfFALSE
a message will be printed to the screen.- pop
a character vector OR formula specifying the population factor. This can be used to specify a specific subset of strata or custom population factor for the output. Note that the
allstrata
command has precedence over this unless the value of this is a new population factor.- allstrata
if this is
TRUE
, the strata will be combined into a single population factor in the genalex file.- geo
logical
Default isFALSE
. If it is set toTRUE
, the resulting file will have two columns for geographic data.- geodf
character
Since theother
slot in the adegenet object can contain many different items, you must specify the name of the data frame in theother
slot containing your geographic coordinates. It defaults to "xy".- sep
a character specifying what character to use to separate columns. Defaults to ",".
- sequence
when
TRUE
, sequence data will be converted to integers as per the GenAlEx specifications.
Note
If your data set lacks a population structure, it will be coded in the new file as a single population labeled "Pop". Likewise, if you don't have any labels for your individuals, they will be labeled as "ind1" through "indN", with N being the size of your population.
Examples
# \dontrun{
data(nancycats)
genind2genalex(nancycats, "~/Documents/nancycats.csv", geo=TRUE)
#> Extracting the table ... Writing the table to ~/Documents/nancycats.csv ... Done.
#> [1] "~/Documents/nancycats.csv"
# }