magicsort: Returns a sorted data matrix

Description Usage Arguments Details Author(s) Examples

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)

F Husson, S Le

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")

Example output

Loading required package: FactoMineR
dev.new(): using pdf(file="Rplots1.pdf")

SensoMineR documentation built on July 2, 2020, 1:56 a.m.