parallelTables: Place two or more ztables or figures side by side in Latex or...

Description Usage Arguments Examples

View source: R/parallelTables.R

Description

Place two or more ztables or figures side by side in Latex or HTML format. Requires Latex "boxedminipage" package in preamble. The ztable for this purpose should be made by function ztable with tabular="TRUE".

Usage

1
parallelTables(width, listTables, type = "latex")

Arguments

width

a numeric vector specifies the width to which the tables or figures should be scaled

listTables

a list consists of object of "ztable" or valid figure name

type

Type of table to produce. Possible values for type are "latex" or "html". Default value is "latex".

Examples

1
2
3
4
5
6
7
8
require(ztable)
z=ztable(head(mtcars[1:3]),tabular=TRUE)
parallelTables(c(0.4,0.3),list(z,z))
parallelTables(c(0.5,0.5),list(z,z))
parallelTables(c(0.5,0.5),list(z,z,type="html"))
z1=ztable(head(iris[1:3]),turn=TRUE,angle=10,zebra=1)
z2=ztable(head(iris[1:3]),turn=TRUE,angle=-10,zebra=2)
parallelTables(c(0.5,0.5),list(z1,z2))

Example output

Welcome to package ztable ver 0.1.5
\begin{table}[!htb]
\begin{minipage}{0.4\linewidth}
\centering
\begin{normalsize}
\color{black}
\begin{tabular}{rrrr}
\hline
&mpg&cyl&disp\\ 
\hline
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\\ 
\hline
\end{tabular}
\end{normalsize}
\color{black}
\end{minipage}
\begin{minipage}{0.3\linewidth}
\centering
\begin{normalsize}
\color{black}
\begin{tabular}{rrrr}
\hline
&mpg&cyl&disp\\ 
\hline
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\\ 
\hline
\end{tabular}
\end{normalsize}
\color{black}
\end{minipage}
\end{table}\begin{table}[!htb]
\begin{minipage}{0.5\linewidth}
\centering
\begin{normalsize}
\color{black}
\begin{tabular}{rrrr}
\hline
&mpg&cyl&disp\\ 
\hline
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\\ 
\hline
\end{tabular}
\end{normalsize}
\color{black}
\end{minipage}
\begin{minipage}{0.5\linewidth}
\centering
\begin{normalsize}
\color{black}
\begin{tabular}{rrrr}
\hline
&mpg&cyl&disp\\ 
\hline
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\\ 
\hline
\end{tabular}
\end{normalsize}
\color{black}
\end{minipage}
\end{table}
Lengths of width and tables are different
length of width=2,length of tables=3\begin{table}[!htb]
\begin{minipage}{0.5\linewidth}
\centering
\definecolor{peach-orange}{rgb}{1.0, 0.8, 0.6} 
\begin{turn}{10}
\begin{normalsize}
\color{black}
\begin{tabular}{rrrr}
\hline
&Sepal.Length&Sepal.Width&Petal.Length\\ 
\hline
\cellcolor{peach-orange}1&\cellcolor{peach-orange}5.10&\cellcolor{peach-orange}3.50&\cellcolor{peach-orange}1.40\\ 
2&4.90&3.00&1.40\\ 
\cellcolor{peach-orange}3&\cellcolor{peach-orange}4.70&\cellcolor{peach-orange}3.20&\cellcolor{peach-orange}1.30\\ 
4&4.60&3.10&1.50\\ 
\cellcolor{peach-orange}5&\cellcolor{peach-orange}5.00&\cellcolor{peach-orange}3.60&\cellcolor{peach-orange}1.40\\ 
6&5.40&3.90&1.70\\ 
\hline
\end{tabular}
\end{normalsize}
\end{turn}
\color{black}
\end{minipage}
\begin{minipage}{0.5\linewidth}
\centering
\definecolor{peach-orange}{rgb}{1.0, 0.8, 0.6} 
\begin{turn}{-10}
\begin{normalsize}
\color{black}
\begin{tabular}{rrrr}
\hline
&Sepal.Length&Sepal.Width&Petal.Length\\ 
\hline
1&5.10&3.50&1.40\\ 
\cellcolor{peach-orange}2&\cellcolor{peach-orange}4.90&\cellcolor{peach-orange}3.00&\cellcolor{peach-orange}1.40\\ 
3&4.70&3.20&1.30\\ 
\cellcolor{peach-orange}4&\cellcolor{peach-orange}4.60&\cellcolor{peach-orange}3.10&\cellcolor{peach-orange}1.50\\ 
5&5.00&3.60&1.40\\ 
\cellcolor{peach-orange}6&\cellcolor{peach-orange}5.40&\cellcolor{peach-orange}3.90&\cellcolor{peach-orange}1.70\\ 
\hline
\end{tabular}
\end{normalsize}
\end{turn}
\color{black}
\end{minipage}
\end{table}

ztable documentation built on Sept. 28, 2021, 9:07 a.m.