tidytable: Generate a tidy table.

Description Usage Arguments Value Author(s) Examples

Description

Generate a tidy table.

Usage

1
2
3
4
5
tidytable(table, removeLocation = TRUE, locTrimFraction = 0,
  fixedOrderDims = NULL, orderSummary = "mean", orderDecreasing = TRUE,
  swapDimensions = TRUE, preserveFirst2dim = NULL, swapDecreasing = TRUE,
  chooseFun = "median", valueFun = "mad", removeCommonZeros = TRUE,
  nSig = 2, expsRange = nSig - 1)

Arguments

table

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

removeLocation

Logical, detect and remove the location.

locTrimFraction

The fraction to be trimmed from each end of a sample to find the location.

fixedOrderDims

A vector of dimensions within which elements cannot be reordered.

orderSummary

The summary which we use to order the dimension layers.

orderDecreasing

Logical, if the order of dimension elements is decreasing.

swapDimensions

Logical, reorder dimensions (swap).

preserveFirst2dim

Fix the first 2 dimensions of the table to be a specific two dimensions of the table.

swapDecreasing

Logical, if swap the dimensions in a way of spread decreasing.

chooseFun

The summary to represent the variability (spread) of each dimension/combination of dimensions, can be functions in R or self-defined functions.

valueFun

The summary to measure the variability (spread) of each layer of the dimension/combination of dimensions, can be functions in R or self-defined functions.

removeCommonZeros

Logical, remove common rightmost zeros from all table entries. (Find a unit.)

nSig

Number of digits showed in the table.

expsRange

The range of exponents within which we hope to show most of the values, default is nSig-1

Value

A list containing the named components: tidytable The tidy table, originalTable The original table, location The location removed from the original table, nSig Number of digits shown in the tidy table, units The units of the entries in the tidy table, newDimOrder The new dimension order after swapping the table.

Author(s)

R. Wayne Oldford and Xiaomei Yu

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
table1<-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)
table1 <- matrix(table1, nrow=4,byrow=TRUE,dimnames=list(c("North" ,"South","East","West"),c("Q1","Q2","Q3","Q4")))
table1
tidytable(table1)

table2 <- c(.7999, .7998, .7998, .7997,
3.7999,3.7824,3.7662,3.7223,
0.3,1.2,4.9,145.7,
20.799,20.699,20.899,145.699,
35.3, 34.5,33.6,34.7)
table2 <- matrix(table2, ncol=4,byrow=TRUE,dimnames=list(c("A" ,"B","C","D","E"),c("1","2","3","4")))
tidytable(table2)


UCBAdmissions
tidytable(UCBAdmissions)

HairEyeColor
tidytable(HairEyeColor)


Titanic
tidytable(Titanic)

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