Sort runs in a qlist based on an attribute

sortQ(qlist, by = "k", decreasing = FALSE, debug = FALSE)

Arguments

qlist

A qlist object

by

A valid attribute name. Generally 'k' or 'ind'. Structure runs can take loci, burin, reps etc. Can take more than one name to arrange by multiple fields. For example by=c("ind","k"). See details.

decreasing

A logical indicating the direction of sorting.

debug

Logical for internal use

Value

A sorted qlist object

Details

Argument 'by' can be any attribute name returned by sapply(qlist,attributes) except 'names', 'class' and 'row.names'. This is usually similar to tabulateQ(qlist,sorttable=FALSE).

Examples

sfiles <- list.files(path=system.file("files/structure",package="pophelper"), full.names=TRUE) slist <- readQ(sfiles) slist_1 <- sortQ(slist) names(slist)
#> [1] "structure_01" "structure_02" "structure_03" "structure_04" "structure_05" #> [6] "structure_06" "structure_07" "structure_08" "structure_09" "structure_10" #> [11] "structure_11" "structure_12" "structure_13" "structure_14" "structure_15" #> [16] "structure_16" "structure_17"
names(slist_1)
#> [1] "structure_01" "structure_02" "structure_09" "structure_03" "structure_04" #> [6] "structure_10" "structure_05" "structure_11" "structure_15" "structure_06" #> [11] "structure_12" "structure_16" "structure_07" "structure_13" "structure_17" #> [16] "structure_08" "structure_14"