Returns a sorted data matrix

Share:

Description

Sort the rows and columns of a matrix in a "magic" order or by ascending (or descending) mean or median or geometrical mean.

Usage

1
2
magicsort(matrice, sort.mat = matrice, method = "magic",
    byrow = TRUE, bycol = TRUE, ascending = TRUE)

Arguments

matrice

a data matrix to sort

sort.mat

sort the rows and columns according to the result of the PCA made on this matrix (by default the matrice)

method

four types of calculations, magic ("magic"), ("median"), arithmetical ("mean") or geometrical ("geo") mean (by default magic)

byrow

boolean, if TRUE then data are sorted over the rows

bycol

boolean, if TRUE then data are sorted over the columns

ascending

boolean, if TRUE then data are sorted in ascending order

Details

Very useful function to compare results.

Author(s)

Fran<e7>ois Husson, S<e9>bastien L<ea>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Example 1
data(chocolates)
resdecat<-decat(sensochoc, formul = "~Product", firstvar = 5, 
    graph = FALSE)
coltable(magicsort(resdecat$tabT), level.lower = -1.96, 
    level.upper = 1.96, main.title = "Products' description")

## Example 2
data(chocolates)
resperf<-paneliperf(sensochoc, 
    formul = "~Product+Panelist+Product:Panelist",
    formul.j = "~Product", col.j = 1, firstvar = 5, lastvar = 12,
    synthesis = FALSE, graph = FALSE)
res.sort=magicsort(resperf$prob.ind, method = "median")
coltable(res.sort, main.title = "P-values of the F-test by panelist")

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.