Takes one or more STRUCTURE run files and converts them to a list of dataframes.
readQStructure(files = NULL, indlabfromfile = FALSE, readci = FALSE)
files | A character or character vector of one or more STRUCTURE run
files. Use |
---|---|
indlabfromfile | A logical indicating if individual labels must be read from input file and used as row names for resulting dataframe. Spaces in labels may be replaced with _. |
readci | A logical indicating if confidence intervals from the structure file (if available) should be read. Set to FALSE by default as it take up excess space. |
A list of lists with dataframes is returned. If individual labels are
present in the STRUCTURE file, they are added to the dataframe as row names.
Structure metadata including loci, burnin, reps, elpd, mvll, and vll is added
as attributes to each dataframe. When readci=TRUE
and if CI data is
available, it is read in and attached as attribute named ci. List items are
named by input filenames.
See the vignette for more details.
sfiles <- list.files(path=system.file("files/structure",package="pophelper"), full.names=TRUE) # create a qlist of all runs slist <- readQStructure(sfiles) # use ind names from file slist <- readQStructure(sfiles[1],indlabfromfile=TRUE) # access the first run slist <- readQStructure(sfiles)[[1]] # access names of runs names(slist)#> [1] "Cluster1" "Cluster2"