This function sorts an associationMatrix ascendingly or descendingly by one of its columns.

# S3 method for associationMatrix
sort(x, decreasing = TRUE, byColumn = 1, ...)

Arguments

x

The associationMatrix object to sort.

decreasing

Whether to sort ascendingly (FALSE) or descending (TRUE).

byColumn

Which column to sort the matrix by, as an index.

…

Passed on to sort.

Details

Note that if the associationMatrix contains values of different effectsizes, the sorting may be misleading. For example, a value of Cohen's d of .45 is higher than a value of Pearson's r of .35, and so will end up higher in a 'decreasing' sort - even though the association represented by an r of .35 is stronger than that represented by a d of .45.

Furthermore, only asymmetrical associationMatrices can be sorted; sorting a symmetrical association matrix would also change the order of the columns, after all.

Value

The associationMatrix, but sorted.

See also

Examples

sort(associationMatrix(infert, y=c("parity", "age"), x=c("induced", "case", "spontaneous"), colNames=TRUE));
#> parity age #> induced r=[0.34; 0.54] r=[-0.22; 0.02] #> r=0.45, p<.001 r=-0.1, p=.227 #> spontaneous r=[0.2; 0.42] r=[-0.21; 0.04] #> r=0.31, p<.001 r=-0.08, p=.279 #> case r=[-0.12; 0.13] r=[-0.12; 0.13] #> r=0.01, p=.956 r=0, p=.956