gl.sort | R Documentation |
This function provides the ability to sort genotypes in a genlight object by individual name or population name.
gl.sort(x, sort.by = "pop", order.by = NULL, verbose = NULL)
x |
Genlight object containing SNP/Silicodart genotypes [required]. |
sort.by |
Specify to sort the genotypes by either 'ind', "pop" [default 'pop']. |
order.by |
Vector used to order genotypes [default NULL] |
verbose |
Verbosity: 0, silent or fatal errors; 1, begin and end; 2, progress log; 3, progress and results summary; 5, full report [default NULL, unless specified using gl.set.verbosity] |
This is a function to sort genotypes in a genlight object by individual name or population name. This will be useful if you want to visualise the structure across populations (bands) in a gl.smearplot; order of genotypes is important.
The order.by parameter needs to be a vector upon which to effect the sort, of length of nPop(gl) if sort.by is 'pop' or nInd(gl) if sort.by is 'ind'. For sort.by='ind' order.by can be a vector such as a variable in gl@other$ind.metrics.
If not specified by nominating a vector with order.by, alphabetical order of populations or individuals is used.
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 data manipulation:
gl.define.pop()
,
gl.drop.ind()
,
gl.drop.loc()
,
gl.drop.pop()
,
gl.edit.recode.pop()
,
gl.impute()
,
gl.join()
,
gl.keep.ind()
,
gl.keep.loc()
,
gl.keep.pop()
,
gl.make.recode.ind()
,
gl.merge.pop()
,
gl.reassign.pop()
,
gl.recode.ind()
,
gl.recode.pop()
,
gl.rename.pop()
,
gl.sample()
,
gl.sim.genotypes()
,
gl.subsample.ind()
,
gl.subsample.loc()
#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.