gl.sort | R Documentation |
Often it is desirable to have the genlight object sorted individuals by population names, indiviual name, for example to have a more informative gl.smearplot (showing banding patterns for populations). Also sorting by loci can be informative in some instances. This function provides the ability to sort individuals of a genlight object by providing the order of individuals or populations and also by loci metric providing the order of locis. See examples below for specifics.
gl.sort(x, sort.by = "pop", order.by = NULL, verbose = NULL)
x |
genlight object containing SNP/silicodart genotypes |
sort.by |
either "ind", "pop". Default is pop |
order.by |
that is used to order individuals or loci. Depening on the order.by parameter, this needs to be a vector of length of nPop(genlight) for populations or nInd(genlight) for individuals. If not specified alphabetical order of populations or individuals is used. For sort.by="ind" order.by can be also a vector specifying the order for each individual (for example another ind.metrics) |
verbose |
set verbosity |
This is convenience function to facilitate sorting of individuals within the genlight object. For example if you want to visualise the "band" of population in a gl.smearplot then the order of individuals is important. Also
Returns a reordered genlight object. Sorts also the ind/loc.metrics and coordinates accordingly
Bernd Gruber (Post to https://groups.google.com/d/forum/dartr)
Other base dartR:
gl.sample()
#sort by populations
bc <- gl.sort(bandicoot.gl)
#sort from West to East
bc2 <- gl.sort(bandicoot.gl, sort.by="pop" ,
order.by=c("WA", "SA", "VIC", "NSW", "QLD"))
#sort by missing values
miss <- rowSums(is.na(as.matrix(bandicoot.gl)))
bc3 <- gl.sort(bandicoot.gl, sort.by="ind", order.by=miss)
gl.smearplot(bc3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.