The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Package ztable

Keon-Woong Moon

2021-09-28

Introduction

Table Show

Package “ztable” make everything possible about table. Basically, An object of “ztable” made from a data.frame. The default output format of ztable is RStudio::viewer or web-browser format(type=“viewer”). So if you want to use ztable in a “html” format, you should change the parameter ztable.type to “html”. If you want to use ztable in latex format, you should change the parameter ztable.type to “latex”.

library(ztable)
library(magrittr)
options(ztable.type="html")
z=ztable(head(iris))
z
  Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.10 3.50 1.40 0.20 setosa
2 4.90 3.00 1.40 0.20 setosa
3 4.70 3.20 1.30 0.20 setosa
4 4.60 3.10 1.50 0.20 setosa
5 5.00 3.60 1.40 0.20 setosa
6 5.40 3.90 1.70 0.40 setosa

You can change the position of data in each cell by adjusting the parameter “align”.

z=ztable(head(iris),align="cccccc")
z
  Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.10 3.50 1.40 0.20 setosa
2 4.90 3.00 1.40 0.20 setosa
3 4.70 3.20 1.30 0.20 setosa
4 4.60 3.10 1.50 0.20 setosa
5 5.00 3.60 1.40 0.20 setosa
6 5.40 3.90 1.70 0.40 setosa

You can change background color and font color with addRowColor() function.

z <- ztable(head(iris))
z <- addRowColor(z, rows=1,bg="#C90000",color="white") 
print(z)
  Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.10 3.50 1.40 0.20 setosa
2 4.90 3.00 1.40 0.20 setosa
3 4.70 3.20 1.30 0.20 setosa
4 4.60 3.10 1.50 0.20 setosa
5 5.00 3.60 1.40 0.20 setosa
6 5.40 3.90 1.70 0.40 setosa

The pipe operator(“%>%”) from magrittr package can simplify your R code.

ztable(head(iris)) %>%
    addRowColor(rows=1,bg="#C90000",color="white") %>%
    print
  Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.10 3.50 1.40 0.20 setosa
2 4.90 3.00 1.40 0.20 setosa
3 4.70 3.20 1.30 0.20 setosa
4 4.60 3.10 1.50 0.20 setosa
5 5.00 3.60 1.40 0.20 setosa
6 5.40 3.90 1.70 0.40 setosa

You can add column groups to ztable using addcgroup function. The n.cgroup means how much columns included in each row group.

cgroup=c("Sepal","Petal","Species")
n.cgroup=c(2,2,1)
z <- ztable(head(iris)) %>%
    addcgroup(cgroup=cgroup,n.cgroup=n.cgroup)
z
Sepal   Petal   Species
  Sepal.Length Sepal.Width   Petal.Length Petal.Width   Species
1 5.10 3.50 1.40 0.20 setosa
2 4.90 3.00 1.40 0.20 setosa
3 4.70 3.20 1.30 0.20 setosa
4 4.60 3.10 1.50 0.20 setosa
5 5.00 3.60 1.40 0.20 setosa
6 5.40 3.90 1.70 0.40 setosa

You can add row groups to ztable using addrgroup function. The n.rgroup means how much rows included in each row group. The cspan.rgroup means how much columns occupied by row group name.

rgroup=c("OneToThree","Four","FiveToSix")
n.rgroup=c(3,1,2)

z <- z %>% 
    addrgroup(rgroup=rgroup,n.rgroup=n.rgroup,cspan.rgroup=1)
z
Sepal   Petal   Species
  Sepal.Length Sepal.Width   Petal.Length Petal.Width   Species
OneToThree
1 5.10 3.50 1.40 0.20 setosa
2 4.90 3.00 1.40 0.20 setosa
3 4.70 3.20 1.30 0.20 setosa
Four
4 4.60 3.10 1.50 0.20 setosa
FiveToSix
5 5.00 3.60 1.40 0.20 setosa
6 5.40 3.90 1.70 0.40 setosa
print(z,type="latex")

You can add another colname(subcolname), the N count for example. The length of subcolnames should be same with column count of data.frame. You can use “NA” and the column name spans 2 rows.

ncount=c(123,120,123,124)
sub=paste("(N=",ncount,")",sep="")
z=addSubColNames(z,c(sub,NA))
z
Sepal   Petal   Species
  Sepal.Length Sepal.Width   Petal.Length Petal.Width   Species
  (N=123) (N=120)   (N=123) (N=124)  
OneToThree
1 5.10 3.50 1.40 0.20 setosa
2 4.90 3.00 1.40 0.20 setosa
3 4.70 3.20 1.30 0.20 setosa
Four
4 4.60 3.10 1.50 0.20 setosa
FiveToSix
5 5.00 3.60 1.40 0.20 setosa
6 5.40 3.90 1.70 0.40 setosa

You can merge cells by spanRow or spanCol function.

z=spanRow(z,col=2,from=4,to=7,bg="lightcyan",color="red")
z=spanRow(z,col=3,from=5,to=7,"platinum","blue")
z=spanRow(z,col=4,from=6,to=7,"cyan")
z=spanRow(z,col=5,from=5,to=7,"yellow")
z=spanRow(z,col=6,from=3,to=5,"yellow")
z
Sepal   Petal   Species
  Sepal.Length Sepal.Width   Petal.Length Petal.Width   Species
  (N=123) (N=120)   (N=123) (N=124)  
OneToThree
1 5.10 3.50 1.40 0.20 setosa
2 4.90 3.00 1.40 0.20 setosa
3 4.70 3.20 1.30 0.20
Four
4 3.10 1.50 0.20
FiveToSix
5 1.40 setosa
6 setosa
z=spanCol(z,row=2,from=3,to=4,"yellow")
z=spanCol(z,row=3,from=4,to=5,"lightblue")
z
Sepal   Petal   Species
  Sepal.Length Sepal.Width   Petal.Length Petal.Width   Species
  (N=123) (N=120)   (N=123) (N=124)  
OneToThree
1 5.10 3.50 0.20 setosa
2 4.90 3.00 1.40 setosa
3 4.70 3.20 1.30 0.20
Four
4 3.10 1.50 0.20
FiveToSix
5 1.40 setosa
6 setosa

You can add or adjust vertical lines of table by vlines function

vlines(z,type="all")       # type=1 gets same result
Sepal Petal Species
  Sepal.Length Sepal.Width Petal.Length Petal.Width Species
  (N=123) (N=120) (N=123) (N=124)
OneToThree
1 5.10 3.50 0.20 setosa
2 4.90 3.00 1.40 setosa
3 4.70 3.20 1.30 0.20
Four
4 3.10 1.50 0.20
FiveToSix
5 1.40 setosa
6 setosa
z <- vlines(z,type="none")      # type=0 gets same result
z
Sepal   Petal   Species
  Sepal.Length Sepal.Width   Petal.Length Petal.Width   Species
  (N=123) (N=120)   (N=123) (N=124)  
OneToThree
1 5.10 3.50 0.20 setosa
2 4.90 3.00 1.40 setosa
3 4.70 3.20 1.30 0.20
Four
4 3.10 1.50 0.20
FiveToSix
5 1.40 setosa
6 setosa
z <- z %>% vlines(add=c(1,2,5))
z
Sepal   Petal   Species
  Sepal.Length Sepal.Width   Petal.Length Petal.Width   Species
  (N=123) (N=120)   (N=123) (N=124)  
OneToThree
1 5.10 3.50 0.20 setosa
2 4.90 3.00 1.40 setosa
3 4.70 3.20 1.30 0.20
Four
4 3.10 1.50 0.20
FiveToSix
5 1.40 setosa
6 setosa

Please note that if you add vertical lines between groups, the space between groups(empty columns) disappeared and vice versa.

Merge two tables

You can bind two or more data.frame by cbind function.

t1=head(iris,10)[,c(1,3,5)]
t2=tail(iris,10)[,c(1,3,5)]
t=cbind(t1,t2)
z=ztable(t,caption="Table 1. Top 10 and Last 10 Data from iris",align="ccccccc")
z
Table 1. Top 10 and Last 10 Data from iris
  Sepal.Length Petal.Length Species Sepal.Length Petal.Length Species
1 5.10 1.40 setosa 6.70 5.60 virginica
2 4.90 1.40 setosa 6.90 5.10 virginica
3 4.70 1.30 setosa 5.80 5.10 virginica
4 4.60 1.50 setosa 6.80 5.90 virginica
5 5.00 1.40 setosa 6.70 5.70 virginica
6 5.40 1.70 setosa 6.70 5.20 virginica
7 4.60 1.40 setosa 6.30 5.00 virginica
8 5.00 1.50 setosa 6.50 5.20 virginica
9 4.40 1.40 setosa 6.20 5.40 virginica
10 4.90 1.50 setosa 5.90 5.10 virginica

And then, you can add column groups, row groups, add row colors, add column colors, add cell colors, and merge cells

cgroup=c("Top 10","Last 10")
n.cgroup=c(3,3)
z=addcgroup(z,cgroup=cgroup,n.cgroup=n.cgroup)
z 
Table 1. Top 10 and Last 10 Data from iris
Top 10   Last 10
  Sepal.Length Petal.Length Species   Sepal.Length Petal.Length Species
1 5.10 1.40 setosa 6.70 5.60 virginica
2 4.90 1.40 setosa 6.90 5.10 virginica
3 4.70 1.30 setosa 5.80 5.10 virginica
4 4.60 1.50 setosa 6.80 5.90 virginica
5 5.00 1.40 setosa 6.70 5.70 virginica
6 5.40 1.70 setosa 6.70 5.20 virginica
7 4.60 1.40 setosa 6.30 5.00 virginica
8 5.00 1.50 setosa 6.50 5.20 virginica
9 4.40 1.40 setosa 6.20 5.40 virginica
10 4.90 1.50 setosa 5.90 5.10 virginica
rgroup=c("Top 1-3","Top 4-5",NA," Top 7-10")
n.rgroup=c(3,2,1,4)
z=addrgroup(z,rgroup=rgroup,n.rgroup=n.rgroup,cspan.rgroup=1)
z
Table 1. Top 10 and Last 10 Data from iris
Top 10   Last 10
  Sepal.Length Petal.Length Species   Sepal.Length Petal.Length Species
Top 1-3
1 5.10 1.40 setosa 6.70 5.60 virginica
2 4.90 1.40 setosa 6.90 5.10 virginica
3 4.70 1.30 setosa 5.80 5.10 virginica
Top 4-5
4 4.60 1.50 setosa 6.80 5.90 virginica
5 5.00 1.40 setosa 6.70 5.70 virginica
6 5.40 1.70 setosa 6.70 5.20 virginica
Top 7-10
7 4.60 1.40 setosa 6.30 5.00 virginica
8 5.00 1.50 setosa 6.50 5.20 virginica
9 4.40 1.40 setosa 6.20 5.40 virginica
10 4.90 1.50 setosa 5.90 5.10 virginica
z <- z %>% 
    addRowColor(c(5,10),"pink") %>%
    addColColor(4,"amber") %>%
    addCellColor(rows=c(5,10),cols=4,"red","white")
z
Table 1. Top 10 and Last 10 Data from iris
Top 10   Last 10
  Sepal.Length Petal.Length Species   Sepal.Length Petal.Length Species
Top 1-3
1 5.10 1.40 setosa 6.70 5.60 virginica
2 4.90 1.40 setosa 6.90 5.10 virginica
3 4.70 1.30 setosa 5.80 5.10 virginica
Top 4-5
4 4.60 1.50 setosa 6.80 5.90 virginica
5 5.00 1.40 setosa 6.70 5.70 virginica
6 5.40 1.70 setosa 6.70 5.20 virginica
Top 7-10
7 4.60 1.40 setosa 6.30 5.00 virginica
8 5.00 1.50 setosa 6.50 5.20 virginica
9 4.40 1.40 setosa 6.20 5.40 virginica
10 4.90 1.50 setosa 5.90 5.10 virginica
z <- z %>%
    spanCol(row=2,from=2,to=3,"lightcyan","red") %>%
    spanRow(col=7,from=7,to=8,"cyan")
z
Table 1. Top 10 and Last 10 Data from iris
Top 10   Last 10
  Sepal.Length Petal.Length Species   Sepal.Length Petal.Length Species
Top 1-3
1 5.10 setosa 6.70 5.60 virginica
2 4.90 1.40 setosa 6.90 5.10 virginica
3 4.70 1.30 setosa 5.80 5.10 virginica
Top 4-5
4 4.60 1.50 setosa 6.80 5.90 virginica
5 5.00 1.40 setosa 6.70 5.70 virginica
6 5.40 1.70 setosa 6.70 5.20 virginica
Top 7-10
7 4.60 1.40 setosa 6.30 5.00
8 5.00 1.50 setosa 6.50 5.20 virginica
9 4.40 1.40 setosa 6.20 5.40 virginica
10 4.90 1.50 setosa 5.90 5.10 virginica
hlines(z,type=1)
Table 1. Top 10 and Last 10 Data from iris
Top 10   Last 10
  Sepal.Length Petal.Length Species   Sepal.Length Petal.Length Species
Top 1-3
1 5.10 setosa 6.70 5.60 virginica
2 4.90 1.40 setosa 6.90 5.10 virginica
3 4.70 1.30 setosa 5.80 5.10 virginica
Top 4-5
4 4.60 1.50 setosa 6.80 5.90 virginica
5 5.00 1.40 setosa 6.70 5.70 virginica
6 5.40 1.70 setosa 6.70 5.20 virginica
Top 7-10
7 4.60 1.40 setosa 6.30 5.00
8 5.00 1.50 setosa 6.50 5.20 virginica
9 4.40 1.40 setosa 6.20 5.40 virginica
10 4.90 1.50 setosa 5.90 5.10 virginica

And you can adjust vertical lines, too.

vlines(z,type=0)  # No vertical lines
Table 1. Top 10 and Last 10 Data from iris
Top 10   Last 10
  Sepal.Length Petal.Length Species   Sepal.Length Petal.Length Species
Top 1-3
1 5.10 setosa 6.70 5.60 virginica
2 4.90 1.40 setosa 6.90 5.10 virginica
3 4.70 1.30 setosa 5.80 5.10 virginica
Top 4-5
4 4.60 1.50 setosa 6.80 5.90 virginica
5 5.00 1.40 setosa 6.70 5.70 virginica
6 5.40 1.70 setosa 6.70 5.20 virginica
Top 7-10
7 4.60 1.40 setosa 6.30 5.00
8 5.00 1.50 setosa 6.50 5.20 virginica
9 4.40 1.40 setosa 6.20 5.40 virginica
10 4.90 1.50 setosa 5.90 5.10 virginica
vlines(z,type=1)  # Vertical lines for all column
Table 1. Top 10 and Last 10 Data from iris
Top 10 Last 10
  Sepal.Length Petal.Length Species Sepal.Length Petal.Length Species
Top 1-3
1 5.10 setosa 6.70 5.60 virginica
2 4.90 1.40 setosa 6.90 5.10 virginica
3 4.70 1.30 setosa 5.80 5.10 virginica
Top 4-5
4 4.60 1.50 setosa 6.80 5.90 virginica
5 5.00 1.40 setosa 6.70 5.70 virginica
6 5.40 1.70 setosa 6.70 5.20 virginica
Top 7-10
7 4.60 1.40 setosa 6.30 5.00
8 5.00 1.50 setosa 6.50 5.20 virginica
9 4.40 1.40 setosa 6.20 5.40 virginica
10 4.90 1.50 setosa 5.90 5.10 virginica

Basic Use

Package “ztable” consist of one function: ztable. It’s main function is creating zebra zebra striping tables(tables with alternating row colors) in both Latex and html formats easily from mainly data.frame or an R object such as matrix, lm, aov, anova, glm and coxph objects. It is fully customizable and you can get similar tables in both latex and html format without changing source. The default output is RStudio::viewer, but you can get html format by adding just one sentence.

options(ztable.type="html")

It’s usage is somewhat similar to xtable, but very simple.

data.frame

Basic Use

It’s use is very simple. Just use ‘ztable()’ function. You can get the zebra striping table by set the parameter zebra=1 (default value is NULL)

require(ztable)
options(ztable.type="html")
options(ztable.zebra=1)
options(ztable.zebra.color="platinum")
options(ztable.colnames.bold=TRUE)
ztable(head(mtcars))
  mpg cyl disp hp drat wt qsec vs am gear carb
Mazda RX4 21.00 6.00 160.00 110.00 3.90 2.62 16.46 0.00 1.00 4.00 4.00
Mazda RX4 Wag 21.00 6.00 160.00 110.00 3.90 2.88 17.02 0.00 1.00 4.00 4.00
Datsun 710 22.80 4.00 108.00 93.00 3.85 2.32 18.61 1.00 1.00 4.00 1.00
Hornet 4 Drive 21.40 6.00 258.00 110.00 3.08 3.21 19.44 1.00 0.00 3.00 1.00
Hornet Sportabout 18.70 8.00 360.00 175.00 3.15 3.44 17.02 0.00 0.00 3.00 2.00
Valiant 18.10 6.00 225.00 105.00 2.76 3.46 20.22 1.00 0.00 3.00 1.00

Tailoring zebra striping

You can get non-zebra table by change parameter zebra=NULL or change zebra striping on even rows by zebra=2.

ztable(head(mtcars),zebra=NULL,size=3,
       caption="Table 1. Non-zebra Table with small size")
Table 1. Non-zebra Table with small size
  mpg cyl disp hp drat wt qsec vs am gear carb
Mazda RX4 21.00 6.00 160.00 110.00 3.90 2.62 16.46 0.00 1.00 4.00 4.00
Mazda RX4 Wag 21.00 6.00 160.00 110.00 3.90 2.88 17.02 0.00 1.00 4.00 4.00
Datsun 710 22.80 4.00 108.00 93.00 3.85 2.32 18.61 1.00 1.00 4.00 1.00
Hornet 4 Drive 21.40 6.00 258.00 110.00 3.08 3.21 19.44 1.00 0.00 3.00 1.00
Hornet Sportabout 18.70 8.00 360.00 175.00 3.15 3.44 17.02 0.00 0.00 3.00 2.00
Valiant 18.10 6.00 225.00 105.00 2.76 3.46 20.22 1.00 0.00 3.00 1.00

Customize the caption and the font size

You can change the position of table by using parameter position. You can use “r” for right position, “l” for left position and “c” for center position(default). You can change the color of zebra striping by change the parameter zebra.color. You can also change the size of font from 1 to 10(default is 5). You can change the caption.placement(“top” or “bottom”) and caption.position(“c” for center / “r” for right/ “l” for left).

ztable(head(mtcars[c(1:7)]),zebra=2,zebra.color="lightcyan",size=7,
       caption="Table 2. Left-sided caption at botom with large font",
       caption.placement="bottom",caption.position="l") 
Table 2. Left-sided caption at botom with large font
  mpg cyl disp hp drat wt qsec
Mazda RX4 21.00 6.00 160.00 110.00 3.90 2.62 16.46
Mazda RX4 Wag 21.00 6.00 160.00 110.00 3.90 2.88 17.02
Datsun 710 22.80 4.00 108.00 93.00 3.85 2.32 18.61
Hornet 4 Drive 21.40 6.00 258.00 110.00 3.08 3.21 19.44
Hornet Sportabout 18.70 8.00 360.00 175.00 3.15 3.44 17.02
Valiant 18.10 6.00 225.00 105.00 2.76 3.46 20.22

aov object

‘ztable()’ can be used for ‘aov’ object. When used for ‘aov’ object, the function call is added as footer to the table. The parameter ‘show.footer’ can be used whether or not include footer in the table. Default value is TRUE.

out <- aov(mpg ~ ., data=mtcars)
ztable(out)
  Df Sum Sq Mean Sq F value Pr(>F)
cyl 1 817.71 817.71 116.42 < 0.0001
disp 1 37.59 37.59 5.35 0.0309
hp 1 9.37 9.37 1.33 0.2610
drat 1 16.47 16.47 2.34 0.1406
wt 1 77.48 77.48 11.03 0.0032
qsec 1 3.95 3.95 0.56 0.4617
vs 1 0.13 0.13 0.02 0.8932
am 1 14.47 14.47 2.06 0.1659
gear 1 0.97 0.97 0.14 0.7137
carb 1 0.41 0.41 0.06 0.8122
Residuals 21 147.49 7.02
Call: aov(formula = mpg ~ ., data = mtcars)

Linear model : ‘lm’ object

‘ztable()’ can be used for ‘lm’ object. When used for ‘lm’ object, the function call is added as footer to the table, too.

fit <- lm(mpg ~ cyl + disp + wt + drat + am, data=mtcars)
ztable(fit)
  Estimate Std. Error t value Pr(>|t|)
(Intercept) 41.2964 7.5384 5.48 < 0.0001
cyl -1.7940 0.6505 -2.76 0.0105
disp 0.0074 0.0123 0.60 0.5546
wt -3.5870 1.2105 -2.96 0.0064
drat -0.0936 1.5488 -0.06 0.9523
am 0.1730 1.5300 0.11 0.9109
Call: lm(formula = mpg ~ cyl + disp + wt + drat + am, data = mtcars)

Analysis of Variance Table : ‘anova’ object

‘ztable()’ can be used for ‘anova’ object to show the anova table. When used for ‘anova’ object, headings of anova are added as headings to the table. The parameter ‘show.footer’ can be used whether or not include footer in the table. Dafault value is TRUE.

a=anova(fit)
ztable(a)
Analysis of Variance Table
Response: mpg
  Df Sum Sq Mean Sq F value Pr(>F)
cyl 1 817.71 817.71 112.85 < 0.0001
disp 1 37.59 37.59 5.19 0.0312
wt 1 82.25 82.25 11.35 0.0024
drat 1 0.00 0.00 0.00 0.9939
am 1 0.09 0.09 0.01 0.9109
Residuals 26 188.40 7.25

This is examples of another ‘anova’ object. The models in this anova tables showed as table headings. You can decide whether or not include the headings in the table by using parameter ‘show.heading’(default: TRUE).

fit2 <- lm(mpg ~ cyl+wt, data=mtcars)
b=anova(fit2,fit)
ztable(b)
Analysis of Variance Table
Model 1: mpg ~ cyl + wt
Model 2: mpg ~ cyl + disp + wt + drat + am
  Res.Df RSS Df Sum of Sq F Pr(>F)
1 29.0 191.17
2 26.0 188.40 3.0 2.77 0.13 0.9429
ztable(b,show.heading=FALSE)
  Res.Df RSS Df Sum of Sq F Pr(>F)
1 29.0 191.17
2 26.0 188.40 3.0 2.77 0.13 0.9429

Generalized linear model ; ‘glm’ object

‘ztable()’ can be used for ‘glm’(generalized linear model) object. In this time, ‘ztable()’ shows the odds ratio(OR) and 95% confidence interval as well as standard R output.

require(survival)
## Loading required package: survival
data(cancer)
attach(colon)
out <- glm(status ~ rx+obstruct+adhere+nodes+extent, data=colon, family=binomial)
ztable(out)
  Estimate Std. Error z value Pr(>|z|) OR lcl ucl
(Intercept) -2.3642 0.3426 -6.90 < 0.0001 0.09 0.05 0.18
rxLev -0.0712 0.1203 -0.59 0.5538 0.93 0.74 1.18
rxLev+5FU -0.6135 0.1231 -4.98 < 0.0001 0.54 0.43 0.69
obstruct 0.2320 0.1251 1.85 0.0636 1.26 0.99 1.61
adhere 0.4164 0.1429 2.91 0.0036 1.52 1.15 2.01
nodes 0.1845 0.0183 10.06 < 0.0001 1.20 1.16 1.25
extent 0.6238 0.1142 5.46 < 0.0001 1.87 1.49 2.33
Call: glm(formula = status ~ rx + obstruct + adhere + nodes + extent, family = binomial, data = colon)

Again, ‘ztable()’ also shows the anova table of this model.

anova(out)

Analysis of Deviance Table

Model: binomial, link: logit

Response: status

Terms added sequentially (first to last)

     Df Deviance Resid. Df Resid. Dev

NULL 1821 2525.4 rx 2 34.841 1819 2490.6 obstruct 1 3.661 1818 2486.9 adhere 1 11.737 1817 2475.2 nodes 1 145.012 1816 2330.2 extent 1 32.594 1815 2297.6

ztable(anova(out))
Analysis of Deviance Table
Model: binomial, link: logit
Response: status
Terms added sequentially (first to last)
  Df Deviance Resid. Df Resid. Dev
NULL 1821 2525.40
rx 2 34.84 1819 2490.56
obstruct 1 3.66 1818 2486.90
adhere 1 11.74 1817 2475.16
nodes 1 145.01 1816 2330.15
extent 1 32.59 1815 2297.55

More ‘aov’ object

op <- options(contrasts = c("contr.helmert", "contr.poly"))
npk.aov <- aov(yield ~ block + N*P*K, npk) 
ztable(npk.aov,zebra=1)
  Df Sum Sq Mean Sq F value Pr(>F)
block 5 343.29 68.66 4.45 0.0159
N 1 189.28 189.28 12.26 0.0044
P 1 8.40 8.40 0.54 0.4749
K 1 95.20 95.20 6.17 0.0288
N:P 1 21.28 21.28 1.38 0.2632
N:K 1 33.14 33.14 2.15 0.1686
P:K 1 0.48 0.48 0.03 0.8628
Residuals 12 185.29 15.44
Call: aov(formula = yield ~ block + N * P * K, data = npk)

More ‘lm’ object

ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
group <- gl(2, 10, 20, labels = c("Ctl","Trt"))
weight <- c(ctl, trt)
lm.D9 <- lm(weight ~ group)
ztable(lm.D9)
  Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.8465 0.1557 31.12 < 0.0001
group1 -0.1855 0.1557 -1.19 0.2490
Call: lm(formula = weight ~ group)
ztable(anova(lm.D9),align="|c|rrrr|r|")
Analysis of Variance Table
Response: weight
  Df Sum Sq Mean Sq F value Pr(>F)
group 1 0.69 0.69 1.42 0.2490
Residuals 18 8.73 0.48

More ‘glm’ object

counts <- c(18,17,15,20,10,20,25,13,12)
outcome <- gl(3,1,9)
treatment <- gl(3,3)
d.AD <- data.frame(treatment, outcome, counts)
glm.D93 <- glm(counts ~ outcome + treatment, family = poisson())
ztable(glm.D93)
  Estimate Std. Error z value Pr(>|z|) OR lcl ucl
(Intercept) 2.7954 0.0831 33.64 < 0.0001 16.37 13.91 19.27
outcome1 -0.2271 0.1011 -2.25 0.0246 0.80 0.65 0.97
outcome2 -0.0220 0.0592 -0.37 0.7106 0.98 0.87 1.10
treatment1 -0.0000 0.1000 -0.00 1.0000 1.00 0.82 1.22
treatment2 -0.0000 0.0577 -0.00 1.0000 1.00 0.89 1.12
Call: glm(formula = counts ~ outcome + treatment, family = poisson())

Principal Components Analysis : ‘prcomp’ object

‘ztable()’ can be used in principal components analysis. Followings are examples of ztable() of ‘prcomp’ object.

data(USArrests)
pr1 <- prcomp(USArrests) 
ztable(pr1)
Rotation:
  PC1 PC2 PC3 PC4
Murder 0.0417 -0.0448 0.0799 -0.9949
Assault 0.9952 -0.0588 -0.0676 0.0389
UrbanPop 0.0463 0.9769 -0.2005 -0.0582
Rape 0.0752 0.2007 0.9741 0.0723
ztable(summary(pr1))
Importance of components:
  PC1 PC2 PC3 PC4
Standard deviation 83.7324 14.2124 6.4894 2.4828
Proportion of Variance 0.9655 0.0278 0.0058 0.0008
Cumulative Proportion 0.9655 0.9933 0.9991 1.0000

Survival Analysis : ‘coxph’ object

‘ztable()’ can be used in survival analysis. When used for Cox proportional hazard model, ‘ztable()’ showed the hazard ratio and 95% confidence interval ready for publication to medical journal.

colon$TS = Surv(time,status==1) 
out=coxph(TS~rx+obstruct+adhere+differ+extent+surg+node4,data=colon)
ztable(out)
  HR lcl ucl se(coef) z Pr(>|z|)
rx1 0.999 0.925 1.079 0.039 -0.030 0.9764
rx2 0.871 0.829 0.915 0.025 -5.464 < 0.0001
obstruct 1.267 1.079 1.489 0.082 2.885 0.0039
adhere 1.181 0.991 1.409 0.090 1.856 0.0634
differ 1.219 1.067 1.394 0.068 2.906 0.0037
extent 1.523 1.298 1.787 0.082 5.152 < 0.0001
surg 1.274 1.104 1.469 0.073 3.319 0.0009
node4 2.359 2.059 2.702 0.069 12.383 < 0.0001
Call: coxph(formula = TS ~ rx + obstruct + adhere + differ + extent + surg + node4, data = colon)

Nonlinear Least Squares: ‘nls’ object

‘ztable()’ can be used to determine the nonlinear (weighted) least-squares estimates of the parameters of a nonlinear model. Followings are examples of ztable() of ‘nls’ object.

require(graphics)

DNase1 <- subset(DNase, Run == 1)

## using a selfStart model
fm1DNase1 <- nls(density ~ SSlogis(log(conc), Asym, xmid, scal),DNase1)
summary(fm1DNase1)

Formula: density ~ SSlogis(log(conc), Asym, xmid, scal)

Parameters:
     Estimate Std. Error t value Pr(>|t|)    
Asym  2.34518    0.07815   30.01 2.17e-13 ***
xmid  1.48309    0.08135   18.23 1.22e-10 ***
scal  1.04146    0.03227   32.27 8.51e-14 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.01919 on 13 degrees of freedom

Number of iterations to convergence: 0 
Achieved convergence tolerance: 8.283e-06
ztable(fm1DNase1)
Nonlinear regression model
model: density ~ SSlogis(log(conc), Asym, xmid, scal)
data: DNase1
  Estimate Std. Error t value Pr(>|t|)
Asym 2.3452 0.0782 30.01 < 0.0001
xmid 1.4831 0.0814 18.23 < 0.0001
scal 1.0415 0.0323 32.27 < 0.0001

Maximum-likelihood Fitting of Univariate Distributions

‘ztable()’ can be used in maximum-likelihood fitting of univariate distributions. Followings are examples of ztable() of ‘fitdistr’ object.

require(MASS)
## Loading required package: MASS
set.seed(123)
x <- rgamma(100, shape = 5, rate = 0.1)
a=fitdistr(x, "gamma")
ztable(a)
  shape rate
estimate 6.487 0.137
sd 0.895 0.020
N=100, The log-likelihood=-429.18
x3 <- rweibull(100, shape = 4, scale = 100)
b=fitdistr(x3, "weibull")
ztable(b)
  shape scale
estimate 3.855 102.462
sd 0.305 2.794
N=100, The log-likelihood=-471.68

Customize the zebra striping colors

If you wanted to use several colors for zebra striping, you can set the parameter ‘zebra’ to zero(e.g. zebra=0) and set the ‘zebra.color’ parameter with vector of your favorite colors. Your favorite colors are used to zebra striping. For your convienience, ten colors are predifned for this purpose. The predefined colors are: c(“peach”,“peach-orange”,“peachpuff”,“peach-yellow”,“pear”,“pearl”,“peridot”,“periwinkle”,“pastelred”, “pastelgray”).

ztable(head(mtcars,15),zebra=0,zebra.color=NULL) 
  mpg cyl disp hp drat wt qsec vs am gear carb
Mazda RX4 21.00 6.00 160.00 110.00 3.90 2.62 16.46 0.00 1.00 4.00 4.00
Mazda RX4 Wag 21.00 6.00 160.00 110.00 3.90 2.88 17.02 0.00 1.00 4.00 4.00
Datsun 710 22.80 4.00 108.00 93.00 3.85 2.32 18.61 1.00 1.00 4.00 1.00
Hornet 4 Drive 21.40 6.00 258.00 110.00 3.08 3.21 19.44 1.00 0.00 3.00 1.00
Hornet Sportabout 18.70 8.00 360.00 175.00 3.15 3.44 17.02 0.00 0.00 3.00 2.00
Valiant 18.10 6.00 225.00 105.00 2.76 3.46 20.22 1.00 0.00 3.00 1.00
Duster 360 14.30 8.00 360.00 245.00 3.21 3.57 15.84 0.00 0.00 3.00 4.00
Merc 240D 24.40 4.00 146.70 62.00 3.69 3.19 20.00 1.00 0.00 4.00 2.00
Merc 230 22.80 4.00 140.80 95.00 3.92 3.15 22.90 1.00 0.00 4.00 2.00
Merc 280 19.20 6.00 167.60 123.00 3.92 3.44 18.30 1.00 0.00 4.00 4.00
Merc 280C 17.80 6.00 167.60 123.00 3.92 3.44 18.90 1.00 0.00 4.00 4.00
Merc 450SE 16.40 8.00 275.80 180.00 3.07 4.07 17.40 0.00 0.00 3.00 3.00
Merc 450SL 17.30 8.00 275.80 180.00 3.07 3.73 17.60 0.00 0.00 3.00 3.00
Merc 450SLC 15.20 8.00 275.80 180.00 3.07 3.78 18.00 0.00 0.00 3.00 3.00
Cadillac Fleetwood 10.40 8.00 472.00 205.00 2.93 5.25 17.98 0.00 0.00 3.00 4.00

The color names used for this purpose are predefined in the data ‘zcolors’ included in ‘ztable’ package. Please type ‘?zcolors’ in R console for help file or just type ‘zcolors’. You can see 749 color names defined in data ‘zcolors’.

Vertical striping

If you wanted to vertical striping table, you can get it by set the parameter zebra.type 2. You can change the ztables parameters when printing.

z1=ztable(head(iris),zebra=2)
z1
  Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.10 3.50 1.40 0.20 setosa
2 4.90 3.00 1.40 0.20 setosa
3 4.70 3.20 1.30 0.20 setosa
4 4.60 3.10 1.50 0.20 setosa
5 5.00 3.60 1.40 0.20 setosa
6 5.40 3.90 1.70 0.40 setosa
print(z1,zebra.type=2)
  Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.10 3.50 1.40 0.20 setosa
2 4.90 3.00 1.40 0.20 setosa
3 4.70 3.20 1.30 0.20 setosa
4 4.60 3.10 1.50 0.20 setosa
5 5.00 3.60 1.40 0.20 setosa
6 5.40 3.90 1.70 0.40 setosa
print(z1,zebra=1,zebra.type=2,zebra.colnames=TRUE)
  Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.10 3.50 1.40 0.20 setosa
2 4.90 3.00 1.40 0.20 setosa
3 4.70 3.20 1.30 0.20 setosa
4 4.60 3.10 1.50 0.20 setosa
5 5.00 3.60 1.40 0.20 setosa
6 5.40 3.90 1.70 0.40 setosa

More tailoring zebra striping

You can update parameters of ztable with ‘update_ztable’ function.

options(ztable.zebra.color=NULL)
(z1=ztable(head(iris),zebra=0,zebra.type=2))
  Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.10 3.50 1.40 0.20 setosa
2 4.90 3.00 1.40 0.20 setosa
3 4.70 3.20 1.30 0.20 setosa
4 4.60 3.10 1.50 0.20 setosa
5 5.00 3.60 1.40 0.20 setosa
6 5.40 3.90 1.70 0.40 setosa

You can change the background color of colnames rows by setting zebra.colnames=TRUE.

update_ztable(z1,colnames.bold=TRUE,zebra.colnames=TRUE)
  Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.10 3.50 1.40 0.20 setosa
2 4.90 3.00 1.40 0.20 setosa
3 4.70 3.20 1.30 0.20 setosa
4 4.60 3.10 1.50 0.20 setosa
5 5.00 3.60 1.40 0.20 setosa
6 5.40 3.90 1.70 0.40 setosa

You can customize the striping when printing.

print(z1,zebra.color=c(rep("white",5),"peach"),zebra.colnames=TRUE)
  Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.10 3.50 1.40 0.20 setosa
2 4.90 3.00 1.40 0.20 setosa
3 4.70 3.20 1.30 0.20 setosa
4 4.60 3.10 1.50 0.20 setosa
5 5.00 3.60 1.40 0.20 setosa
6 5.40 3.90 1.70 0.40 setosa

Change the background color of all cells

You can change the background color of all cells by setting the zebra.type=0.

ztable(head(iris),zebra=0,zebra.type=0)
  Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.10 3.50 1.40 0.20 setosa
2 4.90 3.00 1.40 0.20 setosa
3 4.70 3.20 1.30 0.20 setosa
4 4.60 3.10 1.50 0.20 setosa
5 5.00 3.60 1.40 0.20 setosa
6 5.40 3.90 1.70 0.40 setosa
ztable(head(iris),zebra=0,zebra.type=0,zebra.color=zcolors$name,zebra.colnames=TRUE)
  Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.10 3.50 1.40 0.20 setosa
2 4.90 3.00 1.40 0.20 setosa
3 4.70 3.20 1.30 0.20 setosa
4 4.60 3.10 1.50 0.20 setosa
5 5.00 3.60 1.40 0.20 setosa
6 5.40 3.90 1.70 0.40 setosa

Diagonal striping

You can make diagonal striping with use of zebra.color greater/lesser than column length by 1.

ztable(head(iris),zebra=0,zebra.type=0,zebra.color=1:7,zebra.colnames=TRUE)
  Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.10 3.50 1.40 0.20 setosa
2 4.90 3.00 1.40 0.20 setosa
3 4.70 3.20 1.30 0.20 setosa
4 4.60 3.10 1.50 0.20 setosa
5 5.00 3.60 1.40 0.20 setosa
6 5.40 3.90 1.70 0.40 setosa
ztable(head(mtcars[,1:9]),zebra=0,zebra.type=0,zebra.color=1:9,zebra.colnames=TRUE)
  mpg cyl disp hp drat wt qsec vs am
Mazda RX4 21.00 6.00 160.00 110.00 3.90 2.62 16.46 0.00 1.00
Mazda RX4 Wag 21.00 6.00 160.00 110.00 3.90 2.88 17.02 0.00 1.00
Datsun 710 22.80 4.00 108.00 93.00 3.85 2.32 18.61 1.00 1.00
Hornet 4 Drive 21.40 6.00 258.00 110.00 3.08 3.21 19.44 1.00 0.00
Hornet Sportabout 18.70 8.00 360.00 175.00 3.15 3.44 17.02 0.00 0.00
Valiant 18.10 6.00 225.00 105.00 2.76 3.46 20.22 1.00 0.00

All background colors

This is demonstration of All background colors. All 749 colors are available in package ztable. Please type ?zcolors.

mycolor=rep("white",6)
for(i in 1:149){
    mycolor=c(mycolor,"white",zcolors$name[((i-1)*5+1):((i-1)*5+5)])
}
mycolor=c(mycolor,"white",zcolors$name[c(746:749,1)])
a=c(zcolors$name[1:5])
for(i in 2:149){
    a=rbind(a,zcolors$name[((i-1)*5+1):((i-1)*5+5)])
}
a=rbind(a,zcolors$name[c(746:749,1)])
a=data.frame(a,stringsAsFactors=FALSE,row.names=NULL)
ztable(a,zebra=0,zebra.type=0,zebra.color=mycolor,include.rownames=FALSE,
       include.colnames=FALSE,longtable=TRUE)
airforceblue aliceblue alizarin almond amaranth
amber ambersaeece americanrose amethyst anti-flashwhite
antiquebrass antiquefuchsia antiquewhite ao aoenglish
applegreen apricot aqua aquamarine armygreen
arsenic arylideyellow ashgrey asparagus atomictangerine
auburn aureolin aurometalsaurus awesome azurecolorwheel
azurewebazuremist babyblue babyblueeyes babypink ballblue
bananamania bananayellow battleshipgrey bazaar beaublue
beaver beige bisque bistre bittersweet
black blanchedalmond bleudefrance blizzardblue blond
blue bluemunsell bluencs bluepigment blueryb
bluebell bluegray blue-green blue-violet blush
bole bondiblue bostonuniversityred brandeisblue brass
brickred brightcerulean brightgreen brightlavender brightmaroon
brightpink brightturquoise brightube brilliantlavender brilliantrose
brinkpink britishracinggreen bronze browntraditional brownweb
bubblegum bubbles buff bulgarianrose burgundy
burlywood burntorange burntsienna burntumber byzantine
byzantium cadet cadetblue cadetgrey cadmiumgreen
cadmiumorange cadmiumred cadmiumyellow calpolypomonagreen cambridgeblue
camel camouflagegreen canaryyellow candyapplered candypink
capri caputmortuum cardinal caribbeangreen carmine
carminepink carminered carnationpink carnelian carolinablue
carrotorange ceil celadon celestialblue cerise
cerisepink cerulean ceruleanblue chamoisee champagne
charcoal chartreusetraditional chartreuseweb cherryblossompink chestnut
chocolatetraditional chocolateweb chromeyellow cinereous cinnabar
cinnamon citrine classicrose cobalt cocoabrown
columbiablue coolblack coolgrey copper copperrose
coquelicot coral coralpink coralred cordovan
corn cornellred cornflowerblue cornsilk cosmiclatte
cottoncandy cream crimson crimsonglory cyan
cyanprocess daffodil dandelion darkblue darkbrown
darkbyzantium darkcandyapplered darkcerulean darkchampagne darkchestnut
darkcoral darkcyan darkelectricblue darkgoldenrod darkgray
darkgreen darkjunglegreen darkkhaki darklava darklavender
darkmagenta darkmidnightblue darkolivegreen darkorange darkorchid
darkpastelblue darkpastelgreen darkpastelpurple darkpastelred darkpink
darkpowderblue darkraspberry darkred darksalmon darkscarlet
darkseagreen darksienna darkslateblue darkslategray darkspringgreen
darktan darktangerine darktaupe darkterracotta darkturquoise
darkviolet dartmouthgreen debianred deepcarmine deepcarminepink
deepcarrotorange deepcerise deepchampagne deepchestnut deepfuchsia
deepjunglegreen deeplilac deepmagenta deeppeach deeppink
deepsaffron deepskyblue denim desert desertsand
dimgray dodgerblue dogwoodrose dollarbill drab
dukeblue earthyellow ecru eggplant eggshell
egyptianblue electricblue electriccrimson electriccyan electricgreen
electricindigo electriclavender electriclime electricpurple electricultramarine
electricviolet electricyellow emerald etonblue fallow
falured fandango fashionfuchsia fawn feldgrau
ferngreen ferrarired fielddrab firebrick fireenginered
flame flamingopink flavescent flax floralwhite
fluorescentorange fluorescentpink fluorescentyellow folly forestgreentraditional
forestgreenweb frenchbeige frenchblue frenchlilac frenchrose
fuchsia fuchsiapink fulvous fuzzywuzzy gainsboro
gamboge ghostwhite ginger glaucous goldmetallic
goldwebgolden goldenbrown goldenpoppy goldenyellow goldenrod
grannysmithapple gray grayhtmlcssgray grayx11gray gray-asparagus
greencolorwheelx11green greenhtmlcssgreen greenmunsell greenncs greenpigment
greenryb green-yellow grullo guppiegreen halayaube
hanblue hanpurple hansayellow harlequin harvardcrimson
harvestgold heartgold heliotrope hollywoodcerise honeydew
hotmagenta hotpink huntergreen iceberg icterine
inchworm indiagreen indianred indianyellow indigodye
indigoweb internationalkleinblue internationalorange iris isabelline
islamicgreen ivory jade jasper jazzberryjam
jonquil junebud junglegreen kellygreen khakihtmlcsskhaki
khakix11lightkhaki lasallegreen languidlavender lapislazuli laserlemon
lava lavenderfloral lavenderweb lavenderblue lavenderblush
lavendergray lavenderindigo lavendermagenta lavendermist lavenderpink
lavenderpurple lavenderrose lawngreen lemon lemonchiffon
lightapricot lightblue lightbrown lightcarminepink lightcoral
lightcornflowerblue lightcyan lightfuchsiapink lightgoldenrodyellow lightgray
lightgreen lightkhaki lightmauve lightpastelpurple lightpink
lightsalmon lightsalmonpink lightseagreen lightskyblue lightslategray
lighttaupe lightthulianpink lightyellow lilac limecolorwheel
limewebx11green limegreen lincolngreen linen liver
lust macaroniandcheese magenta magentadye magentaprocess
magicmint magnolia mahogany maize majorelleblue
malachite manatee mangotango maroonhtmlcss maroonx11
mauve mauvetaupe mauvelous mayablue meatbrown
mediumaquamarine mediumblue mediumcandyapplered mediumcarmine mediumelectricblue
mediumjunglegreen mediumlavendermagenta mediumorchid mediumpersianblue mediumpurple
mediumred-violet mediumseagreen mediumslateblue mediumspringbud mediumspringgreen
mediumtaupe mediumtealblue mediumturquoise mediumviolet-red melon
midnightblue midnightgreeneaglegreen mikadoyellow mint mintcream
mintgreen mistyrose moccasin modebeige moonstoneblue
mordantred19 mossgreen mountainmeadow mountbattenpink mulberry
mustard myrtle msugreen nadeshikopink napiergreen
naplesyellow navajowhite navyblue neoncarrot neonfuchsia
neongreen non-photoblue oceanboatblue ochre officegreen
oldgold oldlace oldlavender oldmauve oldrose
olive olivine onyx operamauve orangecolorwheel
orangeryb orangewebcolor orangepeel orange-red orchid
otterbrown outerspace outrageousorange oxfordblue oucrimsonred
pakistangreen palatinateblue palatinatepurple paleaqua paleblue
palebrown palecarmine palecerulean palechestnut palecopper
palecornflowerblue palegold palegoldenrod palegreen palemagenta
palepink paleplum palered-violet palerobineggblue palesilver
palespringbud paletaupe paleviolet-red pansypurple papayawhip
parisgreen pastelblue pastelbrown pastelgray pastelgreen
pastelmagenta pastelorange pastelpink pastelpurple pastelred
pastelviolet pastelyellow patriarch peach peach-orange
peachpuff peach-yellow pear pearl peridot
periwinkle persianblue persiangreen persianindigo persianorange
peru persianpink persianplum persianred persianrose
persimmon phlox phthaloblue phthalogreen piggypink
pinegreen pink pink-orange pinkpearl pinksherbet
pistachio platinum plumtraditional plumweb portlandorange
powderblueweb princetonorange prune prussianblue psychedelicpurple
puce pumpkin purplehtmlcss purplemunsell purplex11
purpleheart purplemountainmajesty purplepizzazz purpletaupe radicalred
raspberry raspberryglace raspberrypink raspberryrose rawumber
razzledazzlerose razzmatazz red redmunsell redncs
redpigment redryb red-brown red-violet redwood
regalia richblack richbrilliantlavender richcarmine richelectricblue
richlavender richlilac richmaroon riflegreen robineggblue
rose rosebonbon roseebony rosegold rosemadder
rosepink rosequartz rosetaupe rosevale rosewood
rossocorsa rosybrown royalazure royalbluetraditional royalblueweb
royalfuchsia royalpurple ruby ruddy ruddybrown
ruddypink rufous russet rust sacramentostategreen
saddlebrown safetyorangeblazeorange saffron salmon salmonpink
sand sanddune sandstorm sandybrown sandytaupe
sangria sapgreen sapphire satinsheengold scarlet
schoolbusyellow screamingreen seagreen sealbrown seashell
selectiveyellow sepia shadow shamrockgreen shockingpink
sienna silver sinopia skobeloff skyblue
skymagenta slateblue slategray smaltdarkpowderblue smokeytopaz
smokyblack snow spirodiscoball splashedwhite springbud
springgreen steelblue stildegrainyellow straw sunglow
sunset tan tangelo tangerine tangerineyellow
taupe taupegray teagreen tearoseorange tearoserose
teal tealblue tealgreen terracotta thistle
thulianpink ticklemepink tiffanyblue timberwolf titaniumyellow
tomato toolbox tractorred trolleygrey tropicalrainforest
trueblue tuftsblue tumbleweed turkishrose turquoise
turquoiseblue turquoisegreen tuscanred twilightlavender tyrianpurple
uablue uared ube uclablue uclagold
ufogreen ultramarine ultramarineblue ultrapink umber
unitednationsblue unmellowyellow upforestgreen upmaroon upsdellred
urobilin usccardinal uscgold utahcrimson vanilla
vegasgold venetianred verdigris vermilion veronica
violet violetcolorwheel violetryb violetweb viridian
vividauburn vividburgundy vividcerise vividtangerine vividviolet
warmblack wenge wheat white whitesmoke
wildblueyonder wildstrawberry wildwatermelon wisteria xanadu
yaleblue yellow yellowmunsell yellowncs yellowprocess
yellowryb yellow-green zaffre zinnwalditebrown airforceblue

Place two or more ztables or figures side by side

If you wanted to place two or more ztables or figures side by side, you can use function parallelTables(). Function parallelTables() takes three parameters. The first parameter width is a numeric vector specifies the width to which the tables or figures should be scaled. The second parameter is a list of ztable or names of valid figure. The 3rd parameter ‘type’ is the type of table to produce. Possible values for type are “latex” or “html”. Default value is “latex”. See the examples.

z=ztable(head(mtcars[1:3]),tabular=TRUE,zebra.color="peach-orange")
z1=ztable(head(iris[1:3]),tabular=TRUE,zebra=2)

parallelTables(width=c(0.5,0.5),list(z,z1),type="html")
  mpg cyl disp
Mazda RX4 21.00 6.00 160.00
Mazda RX4 Wag 21.00 6.00 160.00
Datsun 710 22.80 4.00 108.00
Hornet 4 Drive 21.40 6.00 258.00
Hornet Sportabout 18.70 8.00 360.00
Valiant 18.10 6.00 225.00
  Sepal.Length Sepal.Width Petal.Length
1 5.10 3.50 1.40
2 4.90 3.00 1.40
3 4.70 3.20 1.30
4 4.60 3.10 1.50
5 5.00 3.60 1.40
6 5.40 3.90 1.70
parallelTables(width=c(0.5,0.5),list(z,"figures/ztable3.png"),type="html")
  mpg cyl disp
Mazda RX4 21.00 6.00 160.00
Mazda RX4 Wag 21.00 6.00 160.00
Datsun 710 22.80 4.00 108.00
Hornet 4 Drive 21.40 6.00 258.00
Hornet Sportabout 18.70 8.00 360.00
Valiant 18.10 6.00 225.00

mytable object from “moonBook” package

‘ztable()’ can be used for ‘mytable’ object made by “mytable” function from “moonBook” package.

require(moonBook)
res=mytable(Dx~.,data=acs)
options(ztable.zebra=NULL)
z=ztable(res)
z
NSTEMI STEMI Unstable Angina p
(N=153) (N=304) (N=400)
age 64.3 ± 12.3 62.1 ± 12.1 63.8 ± 11.0 0.073
sex 0.012
    Female 50 (32.7%) 84 (27.6%) 153 (38.2%)
    Male 103 (67.3%) 220 (72.4%) 247 (61.8%)
cardiogenicShock < 0.001
    No 149 (97.4%) 256 (84.2%) 400 (100.0%)
    Yes 4 ( 2.6%) 48 (15.8%) 0 ( 0.0%)
entry 0.001
    Femoral 58 (37.9%) 133 (43.8%) 121 (30.2%)
    Radial 95 (62.1%) 171 (56.2%) 279 (69.8%)
EF 55.0 ± 9.3 52.4 ± 9.5 59.2 ± 8.7 < 0.001
height 163.3 ± 8.2 165.1 ± 8.2 161.7 ± 9.7 < 0.001
weight 64.3 ± 10.2 65.7 ± 11.6 64.5 ± 11.6 0.361
BMI 24.1 ± 3.2 24.0 ± 3.3 24.6 ± 3.4 0.064
obesity 0.186
    No 106 (69.3%) 209 (68.8%) 252 (63.0%)
    Yes 47 (30.7%) 95 (31.2%) 148 (37.0%)
TC 193.7 ± 53.6 183.2 ± 43.4 183.5 ± 48.3 0.057
LDLC 126.1 ± 44.7 116.7 ± 39.5 112.9 ± 40.4 0.004
HDLC 38.9 ± 11.9 38.5 ± 11.0 37.8 ± 10.9 0.501
TG 130.1 ± 88.5 106.5 ± 72.0 137.4 ± 101.6 < 0.001
DM 0.209
    No 96 (62.7%) 208 (68.4%) 249 (62.2%)
    Yes 57 (37.3%) 96 (31.6%) 151 (37.8%)
HBP 0.002
    No 62 (40.5%) 150 (49.3%) 144 (36.0%)
    Yes 91 (59.5%) 154 (50.7%) 256 (64.0%)
smoking < 0.001
    Ex-smoker 42 (27.5%) 66 (21.7%) 96 (24.0%)
    Never 50 (32.7%) 97 (31.9%) 185 (46.2%)
    Smoker 61 (39.9%) 141 (46.4%) 119 (29.8%)
vlines(z,type="all")
NSTEMI STEMI Unstable Angina p
(N=153) (N=304) (N=400)
age 64.3 ± 12.3 62.1 ± 12.1 63.8 ± 11.0 0.073
sex 0.012
    Female 50 (32.7%) 84 (27.6%) 153 (38.2%)
    Male 103 (67.3%) 220 (72.4%) 247 (61.8%)
cardiogenicShock < 0.001
    No 149 (97.4%) 256 (84.2%) 400 (100.0%)
    Yes 4 ( 2.6%) 48 (15.8%) 0 ( 0.0%)
entry 0.001
    Femoral 58 (37.9%) 133 (43.8%) 121 (30.2%)
    Radial 95 (62.1%) 171 (56.2%) 279 (69.8%)
EF 55.0 ± 9.3 52.4 ± 9.5 59.2 ± 8.7 < 0.001
height 163.3 ± 8.2 165.1 ± 8.2 161.7 ± 9.7 < 0.001
weight 64.3 ± 10.2 65.7 ± 11.6 64.5 ± 11.6 0.361
BMI 24.1 ± 3.2 24.0 ± 3.3 24.6 ± 3.4 0.064
obesity 0.186
    No 106 (69.3%) 209 (68.8%) 252 (63.0%)
    Yes 47 (30.7%) 95 (31.2%) 148 (37.0%)
TC 193.7 ± 53.6 183.2 ± 43.4 183.5 ± 48.3 0.057
LDLC 126.1 ± 44.7 116.7 ± 39.5 112.9 ± 40.4 0.004
HDLC 38.9 ± 11.9 38.5 ± 11.0 37.8 ± 10.9 0.501
TG 130.1 ± 88.5 106.5 ± 72.0 137.4 ± 101.6 < 0.001
DM 0.209
    No 96 (62.7%) 208 (68.4%) 249 (62.2%)
    Yes 57 (37.3%) 96 (31.6%) 151 (37.8%)
HBP 0.002
    No 62 (40.5%) 150 (49.3%) 144 (36.0%)
    Yes 91 (59.5%) 154 (50.7%) 256 (64.0%)
smoking < 0.001
    Ex-smoker 42 (27.5%) 66 (21.7%) 96 (24.0%)
    Never 50 (32.7%) 97 (31.9%) 185 (46.2%)
    Smoker 61 (39.9%) 141 (46.4%) 119 (29.8%)

cbind.mytable object

‘ztable()’ can be used for ‘cbind.mytable’ object made by “mytable” function from “moonBook” package.

res1=mytable(sex+DM~.,data=acs)
z=ztable(res1)
z
Descriptive Statistics Stratified by ‘SEX’ and ‘DM’
  Male   Female
  No Yes p   No Yes p
  (N=380) (N=190)   (N=173) (N=114)
age 60.9 ± 11.5 60.1 ± 10.6 0.472 69.3 ± 11.4 67.8 ± 9.7 0.257
cardiogenicShock 0.685 0.296
    No 355 (93.4%) 175 (92.1%) 168 (97.1%) 107 (93.9%)
    Yes 25 ( 6.6%) 15 ( 7.9%) 5 ( 2.9%) 7 ( 6.1%)
entry 0.552 0.665
    Femoral 125 (32.9%) 68 (35.8%) 74 (42.8%) 45 (39.5%)
    Radial 255 (67.1%) 122 (64.2%) 99 (57.2%) 69 (60.5%)
Dx 0.219 0.240
    NSTEMI 71 (18.7%) 32 (16.8%) 25 (14.5%) 25 (21.9%)
    STEMI 154 (40.5%) 66 (34.7%) 54 (31.2%) 30 (26.3%)
    Unstable Angina 155 (40.8%) 92 (48.4%) 94 (54.3%) 59 (51.8%)
EF 56.5 ± 8.3 53.9 ± 11.0 0.007 56.0 ± 10.1 56.6 ± 10.0 0.655
height 168.1 ± 5.8 167.5 ± 6.7 0.386 153.9 ± 6.5 153.6 ± 5.8 0.707
weight 68.1 ± 10.4 69.8 ± 10.2 0.070 56.5 ± 8.7 58.4 ± 10.0 0.106
BMI 24.0 ± 3.1 24.9 ± 3.5 0.005 23.8 ± 3.2 24.8 ± 4.0 0.046
obesity 0.027 0.359
    No 261 (68.7%) 112 (58.9%) 121 (69.9%) 73 (64.0%)
    Yes 119 (31.3%) 78 (41.1%) 52 (30.1%) 41 (36.0%)
TC 184.1 ± 46.7 181.8 ± 44.5 0.572 186.0 ± 43.1 193.3 ± 60.8 0.274
LDLC 117.9 ± 41.8 112.1 ± 39.4 0.115 116.3 ± 35.2 119.8 ± 48.6 0.519
HDLC 38.4 ± 11.4 36.8 ± 9.6 0.083 39.2 ± 10.9 38.8 ± 12.2 0.821
TG 115.2 ± 72.2 153.4 ± 130.7 < 0.001 114.2 ± 82.4 128.4 ± 65.5 0.112
HBP < 0.001 0.356
    No 205 (53.9%) 68 (35.8%) 54 (31.2%) 29 (25.4%)
    Yes 175 (46.1%) 122 (64.2%) 119 (68.8%) 85 (74.6%)
smoking 0.386 0.093
    Ex-smoker 101 (26.6%) 54 (28.4%) 34 (19.7%) 15 (13.2%)
    Never 77 (20.3%) 46 (24.2%) 118 (68.2%) 91 (79.8%)
    Smoker 202 (53.2%) 90 (47.4%) 21 (12.1%) 8 ( 7.0%)
vlines(z,type="all")
Descriptive Statistics Stratified by ‘SEX’ and ‘DM’
Male Female
No Yes p No Yes p
(N=380) (N=190) (N=173) (N=114)
age 60.9 ± 11.5 60.1 ± 10.6 0.472 69.3 ± 11.4 67.8 ± 9.7 0.257
cardiogenicShock 0.685 0.296
    No 355 (93.4%) 175 (92.1%) 168 (97.1%) 107 (93.9%)
    Yes 25 ( 6.6%) 15 ( 7.9%) 5 ( 2.9%) 7 ( 6.1%)
entry 0.552 0.665
    Femoral 125 (32.9%) 68 (35.8%) 74 (42.8%) 45 (39.5%)
    Radial 255 (67.1%) 122 (64.2%) 99 (57.2%) 69 (60.5%)
Dx 0.219 0.240
    NSTEMI 71 (18.7%) 32 (16.8%) 25 (14.5%) 25 (21.9%)
    STEMI 154 (40.5%) 66 (34.7%) 54 (31.2%) 30 (26.3%)
    Unstable Angina 155 (40.8%) 92 (48.4%) 94 (54.3%) 59 (51.8%)
EF 56.5 ± 8.3 53.9 ± 11.0 0.007 56.0 ± 10.1 56.6 ± 10.0 0.655
height 168.1 ± 5.8 167.5 ± 6.7 0.386 153.9 ± 6.5 153.6 ± 5.8 0.707
weight 68.1 ± 10.4 69.8 ± 10.2 0.070 56.5 ± 8.7 58.4 ± 10.0 0.106
BMI 24.0 ± 3.1 24.9 ± 3.5 0.005 23.8 ± 3.2 24.8 ± 4.0 0.046
obesity 0.027 0.359
    No 261 (68.7%) 112 (58.9%) 121 (69.9%) 73 (64.0%)
    Yes 119 (31.3%) 78 (41.1%) 52 (30.1%) 41 (36.0%)
TC 184.1 ± 46.7 181.8 ± 44.5 0.572 186.0 ± 43.1 193.3 ± 60.8 0.274
LDLC 117.9 ± 41.8 112.1 ± 39.4 0.115 116.3 ± 35.2 119.8 ± 48.6 0.519
HDLC 38.4 ± 11.4 36.8 ± 9.6 0.083 39.2 ± 10.9 38.8 ± 12.2 0.821
TG 115.2 ± 72.2 153.4 ± 130.7 < 0.001 114.2 ± 82.4 128.4 ± 65.5 0.112
HBP < 0.001 0.356
    No 205 (53.9%) 68 (35.8%) 54 (31.2%) 29 (25.4%)
    Yes 175 (46.1%) 122 (64.2%) 119 (68.8%) 85 (74.6%)
smoking 0.386 0.093
    Ex-smoker 101 (26.6%) 54 (28.4%) 34 (19.7%) 15 (13.2%)
    Never 77 (20.3%) 46 (24.2%) 118 (68.2%) 91 (79.8%)
    Smoker 202 (53.2%) 90 (47.4%) 21 (12.1%) 8 ( 7.0%)

You can use all ztable related function in this table.

z=addRowColor(z,c(13,16),"platinum")
z=addColColor(z,c(5,8),"pink")
z=addCellColor(z,rows=16,cols=c(5,8),bg="orange")
z=addCellColor(z,rows=13,cols=5,bg="orange")
z
Descriptive Statistics Stratified by ‘SEX’ and ‘DM’
  Male   Female
  No Yes p   No Yes p
  (N=380) (N=190)   (N=173) (N=114)
age 60.9 ± 11.5 60.1 ± 10.6 0.472 69.3 ± 11.4 67.8 ± 9.7 0.257
cardiogenicShock 0.685 0.296
    No 355 (93.4%) 175 (92.1%) 168 (97.1%) 107 (93.9%)
    Yes 25 ( 6.6%) 15 ( 7.9%) 5 ( 2.9%) 7 ( 6.1%)
entry 0.552 0.665
    Femoral 125 (32.9%) 68 (35.8%) 74 (42.8%) 45 (39.5%)
    Radial 255 (67.1%) 122 (64.2%) 99 (57.2%) 69 (60.5%)
Dx 0.219 0.240
    NSTEMI 71 (18.7%) 32 (16.8%) 25 (14.5%) 25 (21.9%)
    STEMI 154 (40.5%) 66 (34.7%) 54 (31.2%) 30 (26.3%)
    Unstable Angina 155 (40.8%) 92 (48.4%) 94 (54.3%) 59 (51.8%)
EF 56.5 ± 8.3 53.9 ± 11.0 0.007 56.0 ± 10.1 56.6 ± 10.0 0.655
height 168.1 ± 5.8 167.5 ± 6.7 0.386 153.9 ± 6.5 153.6 ± 5.8 0.707
weight 68.1 ± 10.4 69.8 ± 10.2 0.070 56.5 ± 8.7 58.4 ± 10.0 0.106
BMI 24.0 ± 3.1 24.9 ± 3.5 0.005 23.8 ± 3.2 24.8 ± 4.0 0.046
obesity 0.027 0.359
    No 261 (68.7%) 112 (58.9%) 121 (69.9%) 73 (64.0%)
    Yes 119 (31.3%) 78 (41.1%) 52 (30.1%) 41 (36.0%)
TC 184.1 ± 46.7 181.8 ± 44.5 0.572 186.0 ± 43.1 193.3 ± 60.8 0.274
LDLC 117.9 ± 41.8 112.1 ± 39.4 0.115 116.3 ± 35.2 119.8 ± 48.6 0.519
HDLC 38.4 ± 11.4 36.8 ± 9.6 0.083 39.2 ± 10.9 38.8 ± 12.2 0.821
TG 115.2 ± 72.2 153.4 ± 130.7 < 0.001 114.2 ± 82.4 128.4 ± 65.5 0.112
HBP < 0.001 0.356
    No 205 (53.9%) 68 (35.8%) 54 (31.2%) 29 (25.4%)
    Yes 175 (46.1%) 122 (64.2%) 119 (68.8%) 85 (74.6%)
smoking 0.386 0.093
    Ex-smoker 101 (26.6%) 54 (28.4%) 34 (19.7%) 15 (13.2%)
    Never 77 (20.3%) 46 (24.2%) 118 (68.2%) 91 (79.8%)
    Smoker 202 (53.2%) 90 (47.4%) 21 (12.1%) 8 ( 7.0%)

You can use pipe from package “magrittr”

require(magrittr)

res1=mytable(sex+DM~.,data=acs)
z=ztable(res1)
z %>%
   addRowColor(c(13,16),"platinum") %>%
   addColColor(c(5,8),"pink") %>%
   addCellColor(rows=16,cols=c(5,8),bg="orange") %>%
   addCellColor(rows=13,cols=5,bg="orange") %>%
   print        
Descriptive Statistics Stratified by ‘SEX’ and ‘DM’
  Male   Female
  No Yes p   No Yes p
  (N=380) (N=190)   (N=173) (N=114)
age 60.9 ± 11.5 60.1 ± 10.6 0.472 69.3 ± 11.4 67.8 ± 9.7 0.257
cardiogenicShock 0.685 0.296
    No 355 (93.4%) 175 (92.1%) 168 (97.1%) 107 (93.9%)
    Yes 25 ( 6.6%) 15 ( 7.9%) 5 ( 2.9%) 7 ( 6.1%)
entry 0.552 0.665
    Femoral 125 (32.9%) 68 (35.8%) 74 (42.8%) 45 (39.5%)
    Radial 255 (67.1%) 122 (64.2%) 99 (57.2%) 69 (60.5%)
Dx 0.219 0.240
    NSTEMI 71 (18.7%) 32 (16.8%) 25 (14.5%) 25 (21.9%)
    STEMI 154 (40.5%) 66 (34.7%) 54 (31.2%) 30 (26.3%)
    Unstable Angina 155 (40.8%) 92 (48.4%) 94 (54.3%) 59 (51.8%)
EF 56.5 ± 8.3 53.9 ± 11.0 0.007 56.0 ± 10.1 56.6 ± 10.0 0.655
height 168.1 ± 5.8 167.5 ± 6.7 0.386 153.9 ± 6.5 153.6 ± 5.8 0.707
weight 68.1 ± 10.4 69.8 ± 10.2 0.070 56.5 ± 8.7 58.4 ± 10.0 0.106
BMI 24.0 ± 3.1 24.9 ± 3.5 0.005 23.8 ± 3.2 24.8 ± 4.0 0.046
obesity 0.027 0.359
    No 261 (68.7%) 112 (58.9%) 121 (69.9%) 73 (64.0%)
    Yes 119 (31.3%) 78 (41.1%) 52 (30.1%) 41 (36.0%)
TC 184.1 ± 46.7 181.8 ± 44.5 0.572 186.0 ± 43.1 193.3 ± 60.8 0.274
LDLC 117.9 ± 41.8 112.1 ± 39.4 0.115 116.3 ± 35.2 119.8 ± 48.6 0.519
HDLC 38.4 ± 11.4 36.8 ± 9.6 0.083 39.2 ± 10.9 38.8 ± 12.2 0.821
TG 115.2 ± 72.2 153.4 ± 130.7 < 0.001 114.2 ± 82.4 128.4 ± 65.5 0.112
HBP < 0.001 0.356
    No 205 (53.9%) 68 (35.8%) 54 (31.2%) 29 (25.4%)
    Yes 175 (46.1%) 122 (64.2%) 119 (68.8%) 85 (74.6%)
smoking 0.386 0.093
    Ex-smoker 101 (26.6%) 54 (28.4%) 34 (19.7%) 15 (13.2%)
    Never 77 (20.3%) 46 (24.2%) 118 (68.2%) 91 (79.8%)
    Smoker 202 (53.2%) 90 (47.4%) 21 (12.1%) 8 ( 7.0%)

You can use addSigColor() function to colorized significant rows of ztable.mytable

res1=mytable(sex~.,data=acs)
res1 %>% ztable %>%
   addSigColor %>%
   print        
Female Male p
(N=287) (N=570)
age 68.7 ± 10.7 60.6 ± 11.2 < 0.001
cardiogenicShock 0.136
    No 275 (95.8%) 530 (93.0%)
    Yes 12 ( 4.2%) 40 ( 7.0%)
entry 0.035
    Femoral 119 (41.5%) 193 (33.9%)
    Radial 168 (58.5%) 377 (66.1%)
Dx 0.012
    NSTEMI 50 (17.4%) 103 (18.1%)
    STEMI 84 (29.3%) 220 (38.6%)
    Unstable Angina 153 (53.3%) 247 (43.3%)
EF 56.3 ± 10.1 55.6 ± 9.4 0.387
height 153.8 ± 6.2 167.9 ± 6.1 < 0.001
weight 57.2 ± 9.3 68.7 ± 10.3 < 0.001
BMI 24.2 ± 3.6 24.3 ± 3.2 0.611
obesity 0.580
    No 194 (67.6%) 373 (65.4%)
    Yes 93 (32.4%) 197 (34.6%)
TC 188.9 ± 51.1 183.3 ± 45.9 0.124
LDLC 117.8 ± 41.2 116.0 ± 41.1 0.561
HDLC 39.0 ± 11.5 37.8 ± 10.9 0.145
TG 119.9 ± 76.2 127.9 ± 97.3 0.195
DM 0.077
    No 173 (60.3%) 380 (66.7%)
    Yes 114 (39.7%) 190 (33.3%)
HBP < 0.001
    No 83 (28.9%) 273 (47.9%)
    Yes 204 (71.1%) 297 (52.1%)
smoking < 0.001
    Ex-smoker 49 (17.1%) 155 (27.2%)
    Never 209 (72.8%) 123 (21.6%)
    Smoker 29 (10.1%) 292 (51.2%)
res2<-mytable(sex+DM~.,data=acs)
res2 %>% 
    ztable %>%
    addSigColor(level=0.1,bg="yellow",color="red") %>%
    print
Descriptive Statistics Stratified by ‘SEX’ and ‘DM’
  Male   Female
  No Yes p   No Yes p
  (N=380) (N=190)   (N=173) (N=114)
age 60.9 ± 11.5 60.1 ± 10.6 0.472 69.3 ± 11.4 67.8 ± 9.7 0.257
cardiogenicShock 0.685 0.296
    No 355 (93.4%) 175 (92.1%) 168 (97.1%) 107 (93.9%)
    Yes 25 ( 6.6%) 15 ( 7.9%) 5 ( 2.9%) 7 ( 6.1%)
entry 0.552 0.665
    Femoral 125 (32.9%) 68 (35.8%) 74 (42.8%) 45 (39.5%)
    Radial 255 (67.1%) 122 (64.2%) 99 (57.2%) 69 (60.5%)
Dx 0.219 0.240
    NSTEMI 71 (18.7%) 32 (16.8%) 25 (14.5%) 25 (21.9%)
    STEMI 154 (40.5%) 66 (34.7%) 54 (31.2%) 30 (26.3%)
    Unstable Angina 155 (40.8%) 92 (48.4%) 94 (54.3%) 59 (51.8%)
EF 56.5 ± 8.3 53.9 ± 11.0 0.007 56.0 ± 10.1 56.6 ± 10.0 0.655
height 168.1 ± 5.8 167.5 ± 6.7 0.386 153.9 ± 6.5 153.6 ± 5.8 0.707
weight 68.1 ± 10.4 69.8 ± 10.2 0.070 56.5 ± 8.7 58.4 ± 10.0 0.106
BMI 24.0 ± 3.1 24.9 ± 3.5 0.005 23.8 ± 3.2 24.8 ± 4.0 0.046
obesity 0.027 0.359
    No 261 (68.7%) 112 (58.9%) 121 (69.9%) 73 (64.0%)
    Yes 119 (31.3%) 78 (41.1%) 52 (30.1%) 41 (36.0%)
TC 184.1 ± 46.7 181.8 ± 44.5 0.572 186.0 ± 43.1 193.3 ± 60.8 0.274
LDLC 117.9 ± 41.8 112.1 ± 39.4 0.115 116.3 ± 35.2 119.8 ± 48.6 0.519
HDLC 38.4 ± 11.4 36.8 ± 9.6 0.083 39.2 ± 10.9 38.8 ± 12.2 0.821
TG 115.2 ± 72.2 153.4 ± 130.7 < 0.001 114.2 ± 82.4 128.4 ± 65.5 0.112
HBP < 0.001 0.356
    No 205 (53.9%) 68 (35.8%) 54 (31.2%) 29 (25.4%)
    Yes 175 (46.1%) 122 (64.2%) 119 (68.8%) 85 (74.6%)
smoking 0.386 0.093
    Ex-smoker 101 (26.6%) 54 (28.4%) 34 (19.7%) 15 (13.2%)
    Never 77 (20.3%) 46 (24.2%) 118 (68.2%) 91 (79.8%)
    Smoker 202 (53.2%) 90 (47.4%) 21 (12.1%) 8 ( 7.0%)

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.