Zebra-Striped Tables in LaTeX and HTML Formats

Makes zebra-striped tables (tables with alternating row colors) in LaTeX and HTML formats easily from a data.frame, matrix, lm, aov, anova, glm, coxph, nls, fitdistr, mytable and cbind.mytable objects.

title: "ztable Update" author: "Keon-Woong Moon" date: "2018-05-14" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{ztable_update} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8}

You can install R package "ztable" from CRAN. Current version is 0.1.8.


You can install the developmental version of ztable from github. Current github version is 0.1.9.

if(!require(devtools)) install.packages("devtools")

Make table from a data.frame

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".

z=ztable(head(iris),caption="Table 1. Basic Table")
Table 1. Basic Table
  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 see the fulll vignette here:

  1. ztable vignette: https://cran.r-project.org/web/packages/ztable/vignettes/ztable.html

  2. ztable update: http://rpubs.com/cardiomoon/388645


ztable 0.2.0


  • New function "ztable.table","gradientColor","makeHeatmap" added

  • New vignette "heatmapTable" added

ztable 0.1.9


  • New function "color2hex", "palette2colors" and "ztable2flextable" added

  • "addColColor", "addRowColor" and "addCellColor" function can set background color and font color

  • New vignette "ztable_update" added

  • Bug-fixed

ztable 0.1.8


  • New function added "addFrontColor" which add font color of ztable

  • addcgroup and addrgroup functions now are able to set font colors

ztable 0.1.7


  • ztable.glm uses confint.dafault to compute confidence interval

  • A shiny app "ztableDemo" added in inst folder

ztable 0.1.6


  • new function added "addSigColor" which add color to row or cells with p-value less than sigp of ztable which is made from class "mytable"

  • "ztable" is compatible with magrittr

ztable 0.1.5


  • new function added "hlines" which add and delete horizontal lines of ztable easily

  • "ztable" supports an R object of nls and fitdistr class

  • bug fixed

ztable 0.1.4


  • "ztable" supports merging cells by "spanRow" and "spanCol" function

  • new function added "vlines" which add and delete vertical lines of ztable easily

  • "ztable"" puts horizontal space between column groups without vertical lines, but puts no space when vertical line is present between column groups.

  • "ztable" supports an R object of mytable and cbind.mytable class from the package "moonBook"

ztable 0.1.3


  • new function "addColColor" which add the background color(s) of column(s) of ztable

  • new function "addRowColor" which add the background color(s) of row(s) of ztable

  • new function "addCellColor" which add the background color(s) of cell(s) of ztable

  • new function "addrgroup" which add the row groups to ztable

  • new function "addcgroup" which add the column groups to ztable

  • new function "ztable2viewer" which shows the ztable of html format via rstudio::viewer()

  • "ztable" support row groups and column groups

  • "ztable" support LaTex, HTML and rstudio::viewer output

ztable 0.1.2


  • new function "update_ztable" which update the parameters of ztable.

  • ztable parameters can be changed with "print.ztable" function.

  • bug fixed

  • "ztable" support horizontal,vertical,diagonal striping and combind horizontal and vertical striping

ztable 0.1.1


  • new function "parallelTables" which places two or more ztables or figures side by side in LaTeX or HTML format.

  • bug fixed

  • "ztable" supports longtable, sidewaystable, wraptable and rotating table (turn and rotate).

ztable 0.1.0


  • new function "ztable" which creates 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.

  • new data "zcolors" added

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.2.0 by Keon-Woong Moon, 2 years ago


Browse source code at https://github.com/cran/ztable

Authors: Keon-Woong Moon [aut, cre]

Documentation:   PDF Manual  

Task views: Reproducible Research

GPL-2 license

Imports stringr, magrittr, RColorBrewer, flextable, officer, moonBook, scales

Suggests MASS, survival, testthat, knitr, rmarkdown

Imported by ggiraphExtra, processR, rrtable, webr.

Suggested by moonBook.

See at CRAN