focusTable: Focus the table on those entries having minimal range in...

Description Usage Arguments Value Author(s) Examples

Description

Focus the table on those entries having minimal range in order of magnitude.

Usage

1
focusTable(table, nSig = 2, expsRange = nSig - 1)

Arguments

table

A sample of data, can be a number, a vector or a matrix, an array or a table.

nSig

Number of significant digits to be showed (default is 2).

expsRange

The threshold to allow how many numbers to be shown (default is nSig-1). If the spread of exponents of the table is smaller than expsRange, then all the numbers in the table will be shown in the new table. Otherwise, only those numbers whose exponents are within this expsRange will be displayed without rounding, others will be rounded according to the determined base.

Value

A list containing the focused table, the base number (the exponent of 10) used to construct the units of the table, and a recommended penalty for "scipen" to be used in options(...) when printing 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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
table1 <- c(97623,92243,100906,90397,48296,42317,49983,39097,75238,75162,100116,74235,49699,57212,80196,51092)
table1 <- matrix(table1, nrow=4,byrow=TRUE)
focusTable(table1)


table2<-array(c(0.000012345,0.002,
3.3,4,
20,34,
20000,300000),
c(4,4)
)
focusTable(table2)
focusTable(table2, nSig=3)


table3<-array(c(0.12345,2,
3.3,4,
20.3,34.5,
200,3000),
c(4,4)
)
focusTable(table3)


table4<-array(c(1,20,
33,40,
203,345,
2000,30000),
c(4,4)
)


focusTable(table4)


table5 <- 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(4,4,2))
dimnames(table5) <- list(c("i1","i2","i3","i4"),c("j1","j2","j3","j4"),c("k1","k2"))
focusTable(table5)

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