This function tests Q matrix objects, and converts matrix objects into valid Q matrices.

as.qmatrix(Q)

Arguments

Q

an object of class matrix containing a matrix of ancestry coefficients.

Value

An object of class tess3Q.

See also

plot.tess3Q barplot.tess3Q

Examples

library(tess3r) ## an example with 3 individuals and 2 clusters Qmatrix <- matrix(c(0.4,0.6,0.3,0.7, 0.2, 0.8), byrow = TRUE, nrow = 3) Qmatrix <- as.qmatrix(Qmatrix) barplot(Qmatrix, space = 0, xlab = "individuals", ylab = "Ancestry proportions", main = "Ancestry matrix")
#> Use CreatePalette() to define color palettes.
#> $order #> [1] 1 2 3 #>