orderDim: Reorder the layers of one dimension

Description Usage Arguments Value Author(s) Examples

Description

Reorder the layers of one dimension

Usage

1
orderDim(table, summary = "mean", dim = 1, decreasing = TRUE)

Arguments

table

A sample of data with dimensions >=1, can be a matrix, an array or a table.

summary

A summary based on which we order within a dimension, can be functions in R or self-defined functions.

dim

Which dimension do we want to order.

decreasing

The order type, decreasing or increasing.

Value

The reordered table.

Author(s)

R. Wayne Oldford and Xiaomei Yu

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
table2<-c(97.62,92.24,100.90,90.39,48.29,42.31,49.98,39.09,75.23,75.16,100.11,74.23,49.69,57.21,80.19,51.09)
table2 <- matrix(table2, nrow=4,byrow=TRUE,dimnames=list(c("North" ,"South","East","West"),c("Q1","Q2","Q3","Q4")))
table2
orderDim(table2, dim=1)

UCBAdmissions
orderDim(UCBAdmissions, dim=2)

HairEyeColor
orderDim(UCBAdmissions, dim=3)

Titanic
orderDim(Titanic, dim=3)

rwoldford/tidy-table documentation built on May 12, 2019, 4:38 a.m.