sort.assoc_scores {mclm}R Documentation

Sort an 'assoc_scores' object

Description

Sort a full object of class assoc_scores based on some criterion. It's the same that print does but with a bit more flexibility.

Usage

## S3 method for class 'assoc_scores'
sort(x, decreasing = TRUE, sort_order = "none", ...)

Arguments

x

Object of class assoc_scores.

decreasing

Boolean value.

If sort_order = "alpha" and decreasing = FALSE, the rows will follow the alphabetic order of the types. If decreasing = TRUE instead, it will follow an inverted alphabetic order (from Z to A). This follows the behavior of applying sort() to a character vector: note that the default value is probably not what you would want.

If sort_order is a column for which a lower value indicates a higher association, i.e. it's a form of p-value, decreasing = TRUE will place lower values on top and higher values at the bottom.

For any other column, decreasing = TRUE will place higher values on top and lower values at the bottom.

sort_order

Criterion to order the rows. Possible values are "alpha" (meaning that the items are to be sorted alphabetically), "none" (meaning that the items are not to be sorted) and any present column name.

...

Additional arguments.

Value

An object of class assoc_scores.

Examples

a <- c(10,    30,    15,    1)
b <- c(200, 1000,  5000,  300)
c <- c(100,   14,    16,    4)
d <- c(300, 5000, 10000, 6000)
types <- c("four", "fictitious", "toy", "examples")
(scores <- assoc_abcd(a, b, c, d, types = types))

print(scores, sort_order = "PMI")
sorted_scores <- sort(scores, sort_order = "PMI")
sorted_scores

sort(scores, decreasing = FALSE, sort_order = "PMI")

[Package mclm version 0.2.7 Index]