showtidytable: Show (Print) tidy table in console or LaTex.

Description Usage Arguments Value Author(s) Examples

Description

Show (Print) tidy table in console or LaTex.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
showtidytable(table, display = c("console", "latex"), tableCaption = NULL,
  file = NULL, append = FALSE, removeLocation = TRUE,
  printLocation = TRUE, locationType = c("common", "withinEachTwoWay"),
  locTrimFraction = 0, fixedOrderDims = NULL, orderSummary = "mean",
  orderDecreasing = TRUE, orderType = c("common", "withinEachTwoWay"),
  swapDimensions = TRUE, preserveFirst2dim = NULL, swapDecreasing = TRUE,
  chooseFun = "median", valueFun = "mad", swapType = c("common",
  "withinEachTwoWay"), removeCommonZeros = TRUE, printUnit = TRUE,
  unitType = c("common", "withinEachTwoWay"), nSig = 2, expsRange = nSig -
  2)

Arguments

table

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

display

To show the table in console or laTex.

tableCaption

The caption of the table.

file

If NULL, then the latex code will be shown in console. Otherwise, the code will be written to file (as in the latex command from the Hmisc package).

append

Logical, append latex output to an existing file.

removeLocation

Logical, detect and remove the location.

printLocation

Logical, print the location.

locationType

Whether to remove and print the location within each two-way block.

locTrimFraction

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

fixedOrderDims

A vector of those dimensions within which the layers cannot be reordered.

orderSummary

The summary which we use to order the dimension layerss.

orderDecreasing

Logical, if the order of dimension elements is decreasing.

orderType

Whether to order the rows and columns within each two-way block.

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.

swapType

Whether to swap the rows and columns within each two-way block.

removeCommonZeros

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

printUnit

Logical, whether to print the location.

unitType

Whether to remove common zeros and print unit within each two-way block.

nSig

Number of digits showed in the table.

expsRange

The threshold to allow how many numbers to be showed. If the spread of exponents of the table is smaller than expsRange, then all the numbers in the table will be showed in the new table. Otherwise, only those numbers whose exponents are within this expsRange will be displayed and we will try to display most of the numbers.

Value

The tidy table in console or laTex format.

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
24
25
26
27
28
29
table <- array(c(5*10^5,9*10^5,2*10^5,8*10^5,
5*10^4,9*10^4,2*10^4,8*10^4,
5*10^2,9*10^2,2*10^2,8*10^2,
5*10^3,9*10^3,2*10^3,8*10^3,
7*10^9,4*10^9,2*10^9,5*10^9,
8*10^2,3*10^2,7*10^2,1*10^2,
6*10^3,8*10^3,2*10^3,9*10^3,
4*10^7,9*10^7,3*10^7,1*10^7
), c(2,2,2,2,2))
dimnames(table) <- list(c("i1","i2"),c("j1","j2"),c("k1","k2"),c("l1","l2"),c("m1","m2"))
table
tidytable(table)
showtidytable(table,display="console",tableCaption="tidy table",
locationType="withinEachTwoWay", orderType="withinEachTwoWay",
swapType="withinEachTwoWay", unitType="withinEachTwoWay")

showtidytable(table,display="latex",tableCaption="tidy table",
locationType="withinEachTwoWay", orderType="withinEachTwoWay",
swapType="withinEachTwoWay", unitType="withinEachTwoWay")


Titanic+264200
showtidytable(Titanic+264200,display="console",
tableCaption="Titanic tidy table", locationType="withinEachTwoWay",
orderType="withinEachTwoWay",swapType="withinEachTwoWay", unitType="withinEachTwoWay")

showtidytable(Titanic+264200,display="latex",tableCaption="Titanic tidy table",
 locationType="withinEachTwoWay", orderType="withinEachTwoWay",
 swapType="withinEachTwoWay", unitType="withinEachTwoWay")

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