349 lines
842 KiB
HTML
Raw Permalink Normal View History

2025-01-12 00:52:51 +08:00
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="Baptiste Auguie" />
<meta name="date" content="2017-09-09" />
<title>Displaying tables as grid graphics</title>
<style type="text/css">code{white-space: pre;}</style>
<style type="text/css">
div.sourceCode { overflow-x: auto; }
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; line-height: 100%; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
td.sourceCode { padding-left: 5px; }
code > span.kw { color: #007020; font-weight: bold; } /* Keyword */
code > span.dt { color: #902000; } /* DataType */
code > span.dv { color: #40a070; } /* DecVal */
code > span.bn { color: #40a070; } /* BaseN */
code > span.fl { color: #40a070; } /* Float */
code > span.ch { color: #4070a0; } /* Char */
code > span.st { color: #4070a0; } /* String */
code > span.co { color: #60a0b0; font-style: italic; } /* Comment */
code > span.ot { color: #007020; } /* Other */
code > span.al { color: #ff0000; font-weight: bold; } /* Alert */
code > span.fu { color: #06287e; } /* Function */
code > span.er { color: #ff0000; font-weight: bold; } /* Error */
code > span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
code > span.cn { color: #880000; } /* Constant */
code > span.sc { color: #4070a0; } /* SpecialChar */
code > span.vs { color: #4070a0; } /* VerbatimString */
code > span.ss { color: #bb6688; } /* SpecialString */
code > span.im { } /* Import */
code > span.va { color: #19177c; } /* Variable */
code > span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code > span.op { color: #666666; } /* Operator */
code > span.bu { } /* BuiltIn */
code > span.ex { } /* Extension */
code > span.pp { color: #bc7a00; } /* Preprocessor */
code > span.at { color: #7d9029; } /* Attribute */
code > span.do { color: #ba2121; font-style: italic; } /* Documentation */
code > span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code > span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
</style>
<link href="data:text/css;charset=utf-8,body%20%7B%0Abackground%2Dcolor%3A%20%23fff%3B%0Amargin%3A%201em%20auto%3B%0Amax%2Dwidth%3A%20800px%3B%0Aoverflow%3A%20visible%3B%0Apadding%2Dleft%3A%202em%3B%0Apadding%2Dright%3A%202em%3B%0Afont%2Dfamily%3A%20%22Helvetica%20Neue%22%2C%20Helvetica%2C%20Arial%2C%20sans%2Dserif%3B%0Afont%2Dsize%3A%2014px%3B%0Aline%2Dheight%3A%2020px%3B%0A%7D%0A%23header%20%7B%0Atext%2Dalign%3A%20center%3B%0A%7D%0A%23TOC%20%7B%0Aclear%3A%20both%3B%0Amargin%3A%200%200%2010px%200%3B%0Apadding%3A%204px%3B%0Aborder%3A%201px%20solid%20%23CCCCCC%3B%0Aborder%2Dradius%3A%205px%3B%0Abackground%2Dcolor%3A%20%23f6f6f6%3B%0Afont%2Dsize%3A%2013px%3B%0Aline%2Dheight%3A%201%2E3%3B%0A%7D%0A%23TOC%20%2Etoctitle%20%7B%0Afont%2Dweight%3A%20bold%3B%0Afont%2Dsize%3A%2015px%3B%0Amargin%2Dleft%3A%205px%3B%0A%7D%0A%23TOC%20ul%20%7B%0Apadding%2Dleft%3A%2040px%3B%0Amargin%2Dleft%3A%20%2D1%2E5em%3B%0Amargin%2Dtop%3A%205px%3B%0Amargin%2Dbottom%3A%205px%3B%0A%7D%0A%23TOC%20ul%20ul%20%7B%0Amargin%2Dleft%3A%20%2D2em%3B%0A%7D%0A%23TOC%20li%20%7B%0Aline%2Dheight%3A%2016px%3B%0A%7D%0Atable%3Anot%28%5Bclass%5D%29%20%7B%0Amargin%3A%20auto%3B%0Amin%2Dwidth%3A%2040%25%3B%0Aborder%2Dwidth%3A%201px%3B%0Aborder%2Dcolor%3A%20%23DDDDDD%3B%0Aborder%2Dstyle%3A%20outset%3B%0Aborder%2Dcollapse%3A%20collapse%3B%0A%7D%0Atable%5Bsummary%3D%22R%20argblock%22%5D%20%7B%0Awidth%3A%20100%25%3B%0Aborder%3A%20none%3B%0A%7D%0Atable%3Anot%28%5Bclass%5D%29%20th%20%7B%0Aborder%2Dwidth%3A%202px%3B%0Apadding%3A%205px%3B%0Aborder%2Dstyle%3A%20inset%3B%0A%7D%0Atable%3Anot%28%5Bclass%5D%29%20td%20%7B%0Aborder%2Dwidth%3A%201px%3B%0Aborder%2Dstyle%3A%20inset%3B%0Aline%2Dheight%3A%2018px%3B%0Apadding%3A%205px%205px%3B%0A%7D%0Atable%3Anot%28%5Bclass%5D%29%2C%20table%3Anot%28%5Bclass%5D%29%20th%2C%20table%3Anot%28%5Bclass%5D%29%20td%20%7B%0Aborder%2Dleft%2Dstyle%3A%20none%3B%0Aborder%2Dright%2Dstyle%3A%20none%3B%0A%7D%0Atable%3Anot%28%5Bclass%5D%29%20tr%2Eodd%20%7B%0Abackground%2Dcolor%3A%20%23f7f7f7%3B%0A%7D%0Ap%20%7B%0Amargin%3A%200%2E5em%200%3B%0A%7D%0Ablockquote%20%7B%0Abackground%2Dcolor%3A%20%23f6f6f6%3B%0Apadding%3A%2013px%3B%0Apadding%2Dbottom%3A%201px%3B%0A%7D%0Ahr%20%7B%0Aborder%2Dstyle%3A%20solid%3B%0Aborder%3A%20none%3B%0Aborder%2Dtop%3A%201px%20solid%20%23777%3B%0Amargin%3A%2028px%200%3B%0A%7D%0Adl%20%7B%0Amargin%2Dleft%3A%200%3B%0A%7D%0Adl%20dd%20%7B%0Amargin%2Dbottom%3A%2013px%3B%0Amargin%2Dleft%3A%2013px%3B%0A%7D%0Adl%20dt%20%7B%0Afont%2Dweight%3A%20bold%3B%0A%7D%0Aul%20%7B%0Amargin%2Dtop%3A%200%3B%0A%7D%0Aul%20li%20%7B%0Alist%2Dstyle%3A%20circle%20outside%3B%0A%7D%0Aul%20ul%20%7B%0Amargin%2Dbottom%3A%200%3B%0A%7D%0Apre%2C%20code%20%7B%0Abackground%2Dcolor%3A%20%23f5f5f5%3B%0Aborder%2Dradius%3A%203px%3B%0Acolor%3A%20%23333%3B%0A%7D%0Apre%20%7B%0Aoverflow%2Dx%3A%20auto%3B%0Aborder%2Dradius%3A%203px%3B%0Amargin%3A%205px%200%2010px%200%3B%0Apadding%3A%2010px%3B%0A%7D%0Apre%3Anot%28%5Bclass%5D%29%20%7B%0Abackground%2Dcolor%3A%20white%3B%0Aborder%3A%20%23f5f5f5%201px%20solid%3B%0A%7D%0Apre%3Anot%28%5Bclass%5D%29%20code%20%7B%0Acolor%3A%20%23444%3B%0Abackground%2Dcolor%3A%20white%3B%0A%7D%0Acode%20%7B%0Afont%2Dfamily%3A%20monospace%3B%0Afont%2Dsize%3A%2090%25%3B%0A%7D%0Ap%20%3E%20code%2C%20li%20%3E%20code%20%7B%0Apadding%3A%202px%204px%3B%0Acolor%3A%20%23d14%3B%0Aborder%3A%201px%20solid%20%23e1e1e8%3B%0Awhite%2Dspace%3A%20inherit%3B%0A%7D%0Adiv%2Efigure%20%7B%0Atext%2Dalign%3A%20center%3B%0A%7D%0Atable%20%3E%20caption%2C%20div%2Efigure%20p%2Ecaption%20%7B%0Afont%2Dstyle%3A%20italic%3B%0A%7D%0Atable%20%3E%20caption%20span%2C%20div%2Efigure%20p%2Ecaption%20span%20%7B%0Afont%2Dstyle%3A%20normal%3B%0Afont%2Dweight%3A%20bold%3B%0A%7D%0Ap%20%7B%0Amargin%3A%200%200%2010px%3B%0A%7D%0Atable%3Anot%28%5Bclass%5D%29%20%7B%0Amargin%3A%20auto%20auto%2010px%20auto%3B%0A%7D%0Aimg%3Anot%28%5Bclass%5D%29%20%7B%0Abackground%2Dcolor%3A%20%23FFFFFF%3B%0Apadding%3A%202px%3B%0Aborder%2Dradius%3A%203px%3B%0Aborder%3A%201px%20solid%20%23CCCCCC%3B%0Amargin%3A%200%205px%3B%0Amax%2Dwidth%3A%20100%25%3B%0A%7D%0Ah1%20%7B%0Amargin%2Dtop%3A%200%3B%0Afont%2Dsize%3A%2035px%3B%0Aline%2Dheight%3
</head>
<body>
<h1 class="title toc-ignore">Displaying tables as grid graphics</h1>
<h4 class="author"><em>Baptiste Auguie</em></h4>
<h4 class="date"><em>2017-09-09</em></h4>
<div id="TOC">
<ul>
<li><a href="#basic-usage">Basic usage</a></li>
<li><a href="#spacing">Spacing</a></li>
<li><a href="#aesthetic-formatting">Aesthetic formatting</a></li>
<li><a href="#text-justification">Text justification</a></li>
<li><a href="#further-gtable-processing-and-integration">Further gtable processing and integration</a><ul>
<li><a href="#borders-and-separators">Borders and separators</a></li>
<li><a href="#accessing-existing-grobs-in-the-table">Accessing existing grobs in the table</a></li>
</ul></li>
<li><a href="#faster-tables-an-alternative-grid-function">Faster tables: an alternative grid function</a></li>
</ul>
</div>
<p>Tabular data is usually formatted outside the graphics device, e.g via LaTeX, or html tables. However, in some cases it may be convenient to display <em>small</em> tables alongside graphics. A couple of packages offer this possibility with base graphics (<code>plotrix</code> for instance); the <code>gridExtra</code> provides the pair of <code>tableGrob/grid.table</code> functions for this purpose.</p>
<p><em>Note:</em> This vignette uses the development version of <code>gridExtra</code>, some features may not be yet available in the released version.</p>
<div id="basic-usage" class="section level2">
<h2>Basic usage</h2>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">library</span>(gridExtra)
<span class="kw">library</span>(grid)
d &lt;-<span class="st"> </span><span class="kw">head</span>(iris[,<span class="dv">1</span><span class="op">:</span><span class="dv">3</span>])
<span class="kw">grid.table</span>(d)</code></pre></div>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwAAAAGACAYAAAAargV/AAAEDWlDQ1BJQ0MgUHJvZmlsZQAAOI2NVV1oHFUUPrtzZyMkzlNsNIV0qD8NJQ2TVjShtLp/3d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WEohSWVOI7LiyWUY9XZZ28hKQAJOcSylk6UUz5BUeeV155ZbPzzjubgw46yE59JhvpZ3QJk5VK6IiFAl+R5kTgySefNPfee69JN4qZU4QRD6y6WfwCatu2bZVEv/vuuyrnOMFIfipJpQDQ2Q6O3m255ZapoinKecyEvv7666KkFdVEMG/lr3bt9AYIjHTfdtttob2DKu0dF9XfQzHypbJOTjl9DUx+j87mSYARRkay/LLnnnua3r17m/r16/tPm2+//dbaC/o7YDQc6abIEyLQFxGoBgEaX7+kssv2hynnY9XN4pfeKqusYtZZZ52Ed2KqGQD/OqBgTnmnYksfdJyQTJnwzzqce+65Bjt8JyussII7DO0zOIAT93oVBAnj119/PeE0MzW//vqrYW0G5j9+YeDr5Zdftmvh/OcLcVxp77hCMCvXOFTWyUtOMwDJuYRyFi8/fmEB1Kmnnlql808YZgFOOOEEf3B7nKqBrBJQJ0RABLImoLqZNaqCBvR3yIkYhwj+QQ/OMYqfapSf60iy60EFoEWLFma11Vb77w3L/zdr1syuN2AtAn9Nmzb1rumgeATq1atnHQxgGtujR48qCbMuQCICIlB4ApoBKDzTrGOk
</div>
<div id="spacing" class="section level2">
<h2>Spacing</h2>
<p>The spacing of each row/column is automatic, and will adjust to bigger cell contents. Plotmath notation may be used, with the <code>parse=TRUE</code> argument. Note that this is applied to individual strings of text, and reverts to standard text if parsing fails (this is useful when mixing multiline text with plotmath in different cells).</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">d[<span class="dv">2</span>,<span class="dv">3</span>] &lt;-<span class="st"> &quot;this is very wwwwwide&quot;</span>
d[<span class="dv">1</span>,<span class="dv">2</span>] &lt;-<span class="st"> &quot;this</span><span class="ch">\n</span><span class="st">is</span><span class="ch">\n</span><span class="st">tall&quot;</span>
<span class="kw">colnames</span>(d) &lt;-<span class="st"> </span><span class="kw">c</span>(<span class="st">&quot;alpha*integral(xdx,a,infinity)&quot;</span>,
<span class="st">&quot;this text</span><span class="ch">\n</span><span class="st">is high&quot;</span>, <span class="st">'alpha/beta'</span>)
tt &lt;-<span class="st"> </span><span class="kw">ttheme_default</span>(<span class="dt">colhead=</span><span class="kw">list</span>(<span class="dt">fg_params =</span> <span class="kw">list</span>(<span class="dt">parse=</span><span class="ot">TRUE</span>)))
<span class="kw">grid.table</span>(d, <span class="dt">theme=</span>tt)</code></pre></div>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwAAAAJACAYAAAA6rgFWAAAEDWlDQ1BJQ0MgUHJvZmlsZQAAOI2NVV1oHFUUPrtzZyMkzlNsNIV0qD8NJQ2TVjShtLp/3d02bpZJNtoi6GT27s6Yyc44M7v9oU9FUHwx6psUxL+3gCAo9Q/bPrQvlQol2tQgKD60+INQ6Ium65k7M5lpurHeZe58853vnnvuuWfvBei5qliWkRQBFpquLRcy4nOHj4g9K5CEh6AXBqFXUR0rXalMAjZPC3e1W99Dwntf2dXd/p+tt0YdFSBxH2Kz5qgLiI8B8KdVy3YBevqRHz/qWh72Yui3MUDEL3q44WPXw3M+fo1pZuQs4tOIBVVTaoiXEI/MxfhGDPsxsNZfoE1q66ro5aJim3XdoLFw72H+n23BaIXzbcOnz5mfPoTvYVz7KzUl5+FRxEuqkp9G/Ajia219thzg25abkRE/BpDc3pqvphHvRFys2weqvp+krbWKIX7nhDbzLOItiM8358pTwdirqpPFnMF2xLc1WvLyOwTAibpbmvHHcvttU57y5+XqNZrLe3lE/Pq8eUj2fXKfOe3pfOjzhJYtB/yll5SDFcSDiH+hRkH25+L+sdxKEAMZahrlSX8ukqMOWy/jXW2m6M9LDBc31B9LFuv6gVKg/0Szi3KAr1kGq1GMjU/aLbnq6/lRxc4XfJ98hTargX++DbMJBSiYMIe9Ck1YAxFkKEAG3xbYaKmDDgYyFK0UGYpfoWYXG+fAPPI6tJnNwb7ClP7IyF+D+bjOtCpkhz6CFrIa/I6sFtNl8auFXGMTP34sNwI/JhkgEtmDz14ySfaRcTIBInmKPE32kxyyE2Tv+thKbEVePDfW/byMM1Kmm0X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uft+uuvtyVLltikSZPs/PPPt9GjR7ui6/h1111ntWvXtkaNGtkVV1xho0aNKoVqUUYIQAACEIAABCAQCQLMAESiGYunEn///bc999xzNmTIEFtvvfVcwX744Qe78sorTZ+vvvqqnXjiida1a1d37tRTT7WLL77Y2rdvbzVq1CieikSoJPPnz7c//vjD1lprrTK16tu3r3388cfB8Z122skuvPDCYL8iG99//71T9sLX3HTTTbb++uuHDxVsW89fy5YtC3b/yt44U/tVNk+ugwAEIACBeBNgBiDe7Z/z2v/yyy+23XbbBZ1/3UCdrm7dutmdd95pG264oZ1wwgnBfWUG1KZNG5syZUpwjI3cEZAZ1rHHHmsffvhhykznzJljf/75Z/A3d+7clOmyOagZn3Be2taxQsvvv/9u/fr1K6OcFLpc2dy/vPbLJg/SQAACEIAABJIJMAOQTIT9BAILFy60iRMn2jrrrGO1atVKOJdqRx3KzTbbrMyp8ePHu2NSBKpXT9Q7mzZtajNnzrTmzZuXuY4DlSPw7bff2q233mqff/555TKIwFV6dp988kl78MEHTTNTDRs2LJla0X4l01QUFAIQgEBJEkjsiZVkFSh0PgjIWbd///7OgVed9oMOOshuuOGGcm+19tpr25gxYxLS/frrr/bUU09Z/fr17aOPPko4px05BTdr1qzMcQ5UnkCPHj1i3fkXOfmi3HXXXa7zX3mShbmS9isMd+4KAQhAIC4EmAGIS0tXoJ6LFi2ys846y+rWrWt77LGHvfzyy/bXX3/Zs88+a3vttZe1a9cubW7qyM+bN8/Z+nfo0MG++uoru/nmm22llVayQYMG2Y033mgDBw60Tp06uZmA4cOH29KlS61x48Zp8+RExQksW7Ys4aJq1aol7OdjRz4fGm0PSyEVOz1XYakKBuH7rch2IdpvRcrLtRCAAAQgUFoEUABKq72qpLQPPfSQyaFT
</div>
<div id="aesthetic-formatting" class="section level2">
<h2>Aesthetic formatting</h2>
<p>The formatting is controlled by <em>themes</em>, which are nested lists of graphical parameters. See <code>ttheme_default</code> and <code>ttheme_minimal</code> for two built-in examples. Changing a few parameters at a time amounts to modifying the list with the new values.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">tt1 &lt;-<span class="st"> </span><span class="kw">ttheme_default</span>()
tt2 &lt;-<span class="st"> </span><span class="kw">ttheme_minimal</span>()
tt3 &lt;-<span class="st"> </span><span class="kw">ttheme_minimal</span>(
<span class="dt">core=</span><span class="kw">list</span>(<span class="dt">bg_params =</span> <span class="kw">list</span>(<span class="dt">fill =</span> blues9[<span class="dv">1</span><span class="op">:</span><span class="dv">4</span>], <span class="dt">col=</span><span class="ot">NA</span>),
<span class="dt">fg_params=</span><span class="kw">list</span>(<span class="dt">fontface=</span><span class="dv">3</span>)),
<span class="dt">colhead=</span><span class="kw">list</span>(<span class="dt">fg_params=</span><span class="kw">list</span>(<span class="dt">col=</span><span class="st">&quot;navyblue&quot;</span>, <span class="dt">fontface=</span>4L)),
<span class="dt">rowhead=</span><span class="kw">list</span>(<span class="dt">fg_params=</span><span class="kw">list</span>(<span class="dt">col=</span><span class="st">&quot;orange&quot;</span>, <span class="dt">fontface=</span>3L)))
<span class="kw">grid.arrange</span>(
<span class="kw">tableGrob</span>(iris[<span class="dv">1</span><span class="op">:</span><span class="dv">4</span>, <span class="dv">1</span><span class="op">:</span><span class="dv">2</span>], <span class="dt">theme=</span>tt1),
<span class="kw">tableGrob</span>(iris[<span class="dv">1</span><span class="op">:</span><span class="dv">4</span>, <span class="dv">1</span><span class="op">:</span><span class="dv">2</span>], <span class="dt">theme=</span>tt2),
<span class="kw">tableGrob</span>(iris[<span class="dv">1</span><span class="op">:</span><span class="dv">4</span>, <span class="dv">1</span><span class="op">:</span><span class="dv">2</span>], <span class="dt">theme=</span>tt3),
<span class="dt">nrow=</span><span class="dv">1</span>)</code></pre></div>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABgAAAAGACAYAAABr+ak9AAAEDWlDQ1BJQ0MgUHJvZmlsZQAAOI2NVV1oHFUUPrtzZyMkzlNsNIV0qD8NJQ2TVjShtLp/3d02bpZJNtoi6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lUmkQUztTE6mx1EEPh7OmdqBtAvv8HdWpbrJS6tJj3n0CWdM6busNzRV3S9KTYhqvNiqWmuroiKgYhshMjmhTh9ptWhsF7970j/SbMrsPE1suR5z7DMC+P/Hs+y7ijrQAlhyAgccjbhjPygfeBTjzhNqy28EdkUh8C+DU9+z2v/oyeH791OncxHOs5y2AtTc7nb/f73TWPkD/qwBnjX8BoJ98VVBg/m8AAEAASURBVHgB7J0HuBRF1oYLJAiSVAQFFURMKGtYBXPACIJpMWJOa1oDJnTNOWJAMazrbxZzAAWMKCZQwISYRVBQDIgISBD+eputudU1PXPnzk1zZ77zPPdOh+rqqre7uqvPOXWq3hIrRiICIiACIiACIiACIiACIiACIiACIiACIiACIiACIiACIlBUBOoXVW1UGREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQgYiADAC6EURABERABERABERABERABERABERABERABERABERABESgCAnIAFCEF1VVEgEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEZAHQPiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiEAREpABoAgvqqokAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAjIA6B4QAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQgSIkIANAEV5UVUkEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEZADQPSACIiACIiACIiACIiACIiACIiACIiACIiACIiACIiACRUhABoAivKiqkgiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAjIAKB7QAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQASKkIAMAEV4UVUlERABERABERABERABERABERABERABERABERABERABEZABQPeACIiACIiACIiACIiACIiACIiACIiACIiACIiACIiACBQhARkAivCiqkoiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAOA7gEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAERKEICMgAU4UVVlURABERABERABERABERABERABERABERABERABERABERABgDdAyIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiJQhARkACjCi6oqiYAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAMALoHREAEREAEREAEREAEREAEREAEREAEREAEREAEREAERKAICcgAUIQXVVUSAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARkAdA+IgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIQBESkAGgCC+qqiQCIiACIiACIiACIiACIiACIiACIiACIiACIiACIiACMgDoHhABERABERABERABERABERABERABERABERABERABERCBIiQgA0ARXlRVSQREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARkANA9IAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAJFSEAGgCK8qKqSCIiACIiACIiACIiACIiACIiACIiACIiACIiACIiACMgAoHtABERABERABERABERABERABERABERABERABERABERABIqQgAwARXhRVSUREAEREAEREAEREAEREAEREAEREAEREAEREAEREAERkAFA94AIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIFCEBGQCK8KKqSiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgA4DuAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREoQgIyABThRVWVREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAGAN0DIiACIiACIiACIiACIiACIiACIiACIiACIiACIiACIlCEBGQAKMKLqiqJgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAwAugdEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREoAgJyABQhBdVVRIBERABERABERABERABERABERABERABERABERABERABGQB0D4iACIiACIiACIiACIiACIiACIiACIiACIiACIiACIhAERKQAaAIL6qqJAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIyAOgeEAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREIEiJCADQBFeVFVJBERABERABERABERABERABERABERABERABERABERABGQA0D0gAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAkVIQAaAIryoqpIIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIyACge0AEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEipCADABFeFFVJREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGQAUD3gAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAgUIQEZAIrwoqpKIiACIiACIiACIiACIiACIiACIiACIiACIiACIiACIiADgO4BERABERABERABERABERABERABERABERABERABERABEShCAjIAFOFFVZVEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAYA3QMi
<p>If the formatting values are fewer than the number of cells, they are recycled along columns,</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">t1 &lt;-<span class="st"> </span><span class="kw">ttheme_default</span>(<span class="dt">core=</span><span class="kw">list</span>(
<span class="dt">fg_params=</span><span class="kw">list</span>(<span class="dt">fontface=</span><span class="kw">c</span>(<span class="kw">rep</span>(<span class="st">&quot;plain&quot;</span>, <span class="dv">4</span>), <span class="st">&quot;bold.italic&quot;</span>)),
<span class="dt">bg_params =</span> <span class="kw">list</span>(<span class="dt">fill=</span><span class="kw">c</span>(<span class="kw">rep</span>(<span class="kw">c</span>(<span class="st">&quot;grey95&quot;</span>, <span class="st">&quot;grey90&quot;</span>),
<span class="dt">length.out=</span><span class="dv">4</span>), <span class="st">&quot;#6BAED6&quot;</span>),
<span class="dt">alpha =</span> <span class="kw">rep</span>(<span class="kw">c</span>(<span class="dv">1</span>,<span class="fl">0.5</span>), <span class="dt">each=</span><span class="dv">5</span>))
))
<span class="kw">grid.table</span>(iris[<span class="dv">1</span><span class="op">:</span><span class="dv">5</span>, <span class="dv">1</span><span class="op">:</span><span class="dv">3</span>], <span class="dt">theme =</span> t1)</code></pre></div>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwAAAAGACAYAAAAargV/AAAEDWlDQ1BJQ0MgUHJvZmlsZQAAOI2NVV1oHFUUPrtzZyMkzl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wlCkdVm9NOL5BE4wkQ2SMlDZU97hX86EilU/lUmkQUztTE6mx1EEPh7OmdqBtAvv8HdWpbrJS6tJj3n0CWdM6busNzRV3S9KTYhqvNiqWmuroiKgYhshMjmhTh9ptWhsF7970j/SbMrsPE1suR5z7DMC+P/Hs+y7ijrQAlhyAgccjbhjPygfeBTjzhNqy28EdkUh8C+DU9+z2v/oyeH791OncxHOs5y2AtTc7nb/f73TWPkD/qwBnjX8BoJ98VVBg/m8AAEAASURBVHgB7J0HmNVE18fPwtI7SAcFBMWCoKIUKRZEiooN9bVgxd7BgmJDAQuKDURF0deOoqIiiiDYBWkqSC9Kkd7bwrL77X98J19u9pbcu0lubvI/z7N7c5PJzOQ3dzJzZs6cycovEKGQAAmQAAmQAAmQAAmQAAmEgkCxUDwlH5IESIAESIAESIAESIAESEARoALAHwIJkAAJkAAJkAAJkAAJhIgAFYAQFTYflQRIgARIgARIgARIgASoAPA3QAIkQAIkQAIkQAIkQAIhIkAFIESFzUclARIgARIgARIgARIgASoA/A2QAAmQAAmQAAmQAAmQQIgIUAEIUWHzUUmABEiABEiABEiABEiACgB/AyRAAiRAAiRAAiRAAiQQIgJUAEJU2HxUEiABEiABEiABEiABEqACwN8ACZAACZAACZAACZAACYSIABWAEBU2H5UESIAESIAESIAESIAEqADwN0ACJEACJEACJEACJEACISJABSBEhc1HJQESIAESIAESIAESIAEqAPwNkAAJkAAJkAAJkAAJkECICFABCFFh81FJgARIgARIgARIgARIgAoAfwMkQAIkQAIkQAIkQAIkECICVABCVNh8VBIgARIgARIgARIgARKgAsDfAAmQAAmQAAmQAAmQAAmEiAAVgBAVNh+VBEiABEiABEiABEiABKgA8DdAAiRAAiRAAiRAAiRAAiEiQAUgRIXNRyUBEiABEiABEiABEiABKgD8DZAACZAACZAACZAACZBAiAhQAQhRYfNRSYAESIAESIAESIAESIAKAH8DJEACJEACJEACJEACJBAiAlQAQlTYfFQSIAESIAESIAESIAESoALA3wAJkAAJkAAJkAAJkAAJhIgAFY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R/B9dcc03Ee7xnz55y8cUXW4MZ3/fs2SObNm2SOnXqGOf0QVDq1BNPPCE//fSTfqyIT5QdBrxKlCih/sqWLasGv4444gjp1q2b5+/meO+4iIyn+GXx4sXSt2/fiLuHDh0qDRs2jDiX6EtOTo7cd999EcFOOOEEOfvssyPO8UtsArHKeuHChYXarueee071xWLHlrlXqACkoey+//57efzxx2X79u0xU9+7d6/ghTFo0CB5++231Y/yyCOPjBk+qBcw+rp582bj8fA9Ffn777/l119/jbg1Nzc34ju/FCawYcMGQScKStjHH39cOEDBGfyOnSijqJF7fJJ10z7wotZNDHD88ssvRoL4Da1YsSJmY/vDDz9E/M70jbNmzZKTTz5Zf434nDFjRsQ9DRo0UJ1/BCpq/iMSKvgCxdFcD3bv3m0NYnyfNGmSvPjii3LppZdKjx49jPP6ICh1yspYP1+sz3nz5snkyZOVUodBhJNOOilWUMfO23nHOZHY/v37I34fiBPnkpW8vLxCbVm9evWSjSaU4ROVNfoE5joMSKmUUabADeewchpLB43VQw89FLfzb83eX3/9Jffee6/gx0shAS8IQAGF4nnJJZfIhAkTJD8/34tk
</div>
<div id="text-justification" class="section level2">
<h2>Text justification</h2>
<p>The text labels can be justified; the default is “centre” for the core and header, and “right” for the row names. These settings can be adjusted by passing the relevant parameters of <code>textGrob</code> via the theme nested lists,</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">tt1 &lt;-<span class="st"> </span><span class="kw">ttheme_default</span>()
tt2 &lt;-<span class="st"> </span><span class="kw">ttheme_default</span>(<span class="dt">core=</span><span class="kw">list</span>(<span class="dt">fg_params=</span><span class="kw">list</span>(<span class="dt">hjust=</span><span class="dv">1</span>, <span class="dt">x=</span><span class="fl">0.9</span>)),
<span class="dt">rowhead=</span><span class="kw">list</span>(<span class="dt">fg_params=</span><span class="kw">list</span>(<span class="dt">hjust=</span><span class="dv">1</span>, <span class="dt">x=</span><span class="fl">0.95</span>)))
tt3 &lt;-<span class="st"> </span><span class="kw">ttheme_default</span>(<span class="dt">core=</span><span class="kw">list</span>(<span class="dt">fg_params=</span><span class="kw">list</span>(<span class="dt">hjust=</span><span class="dv">0</span>, <span class="dt">x=</span><span class="fl">0.1</span>)),
<span class="dt">rowhead=</span><span class="kw">list</span>(<span class="dt">fg_params=</span><span class="kw">list</span>(<span class="dt">hjust=</span><span class="dv">0</span>, <span class="dt">x=</span><span class="dv">0</span>)))
<span class="kw">grid.arrange</span>(
<span class="kw">tableGrob</span>(mtcars[<span class="dv">1</span><span class="op">:</span><span class="dv">4</span>, <span class="dv">1</span><span class="op">:</span><span class="dv">2</span>], <span class="dt">theme=</span>tt1),
<span class="kw">tableGrob</span>(mtcars[<span class="dv">1</span><span class="op">:</span><span class="dv">4</span>, <span class="dv">1</span><span class="op">:</span><span class="dv">2</span>], <span class="dt">theme=</span>tt2),
<span class="kw">tableGrob</span>(mtcars[<span class="dv">1</span><span class="op">:</span><span class="dv">4</span>, <span class="dv">1</span><span class="op">:</span><span class="dv">2</span>], <span class="dt">theme=</span>tt3),
<span class="dt">nrow=</span><span class="dv">1</span>)</code></pre></div>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABgAAAAGACAYAAABr+ak9AAAEDWlDQ1BJQ0MgUHJvZmlsZQAAOI2NVV1oHFUUPrtzZyMkzlNsNIV0qD8NJQ2TVjShtLp/3d02bpZJNtoi6GT27s6Yyc44M7v9oU9FUHwx6psUxL+3gCAo9Q/bPrQvlQol2tQgKD60+INQ6Ium65k7M5lpurHeZe58853vnnvuuWfvBei5qliWkRQBFpquLRcy4nOHj4g9K5CEh6AXBqFXUR0rXalMAjZPC3e1W99Dwntf2dXd/p+tt0YdFSBxH2Kz5qgLiI8B8KdVy3YBevqRHz/qWh72Yui3MUDEL3q44WPXw3M+fo1pZuQs4tOIBVVTaoiXEI/MxfhGDPsxsNZfoE1q66ro5aJim3XdoLFw72H+n23BaIXzbcOnz5mfPoTvYVz7KzUl5+FRxEuqkp9G/Ajia219thzg25abkRE/BpDc3pqvph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EpCABCQgAQlIQAISkIAEJCABCQwhAR0AQ1ipPpIEJCABCUhAAhKQgAQkIAEJSEACEpCABCQgAQlIQAeA74AEJCABCUhAAhKQgAQkIAEJSEACEpCABCQgAQlIYAgJ6AAYwkr1kSQgAQlIQAISkIAEJCABCUhAAhKQgAQkIAEJSEACOgB8ByQgAQlIQAISkIAEJCABCUhAAhKQgAQkIAEJSEACQ0hAB8AQVqqPJAEJSEACEpCABCQgAQlIQAISkIAEJCAB
</div>
<div id="further-gtable-processing-and-integration" class="section level2">
<h2>Further gtable processing and integration</h2>
<p>Being based on <code>gtable</code>, the table can be further processed. In particular, we may edit the cell sizes to align with other content on the page.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">g &lt;-<span class="st"> </span>g2 &lt;-<span class="st"> </span><span class="kw">tableGrob</span>(iris[<span class="dv">1</span><span class="op">:</span><span class="dv">4</span>, <span class="dv">1</span><span class="op">:</span><span class="dv">3</span>], <span class="dt">cols =</span> <span class="ot">NULL</span>, <span class="dt">rows=</span><span class="ot">NULL</span>)
g2<span class="op">$</span>widths &lt;-<span class="st"> </span><span class="kw">unit</span>(<span class="kw">rep</span>(<span class="dv">1</span><span class="op">/</span><span class="kw">ncol</span>(g2), <span class="kw">ncol</span>(g2)), <span class="st">&quot;npc&quot;</span>)
<span class="kw">grid.arrange</span>(<span class="kw">rectGrob</span>(), <span class="kw">rectGrob</span>(), <span class="dt">nrow=</span><span class="dv">1</span>)
<span class="kw">grid.arrange</span>(g, g2, <span class="dt">nrow=</span><span class="dv">1</span>, <span class="dt">newpage =</span> <span class="ot">FALSE</span>)</code></pre></div>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABgAAAAGACAYAAABr+ak9AAAEDWlDQ1BJQ0MgUHJvZmlsZQAAOI2NVV1oHFUUPrtzZyMkzlNsNIV0qD8NJQ2TVjShtLp/3d02bpZJNtoi6GT27s6Yyc44M7v9oU9FUHwx6psUxL+3gCAo9Q/bPrQvlQol2t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WKhkCQEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABGgD4DCCAAAIIIIAAAggggAACCCCAAAIIIIAAAggg4EMBGgB8WKhkCQEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABGgD4DCCAAAIIIIAAAggggAACCCCAAAIIIIAAAggg4EMBGgB8WKhkCQEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABGgD4DCCAAAIIIIAAAggggAACCCCAAAIIIIAAAggg4EMBGgB8WKhkCQEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABGgD4DCCAAAIIIIAAAggggAACCCCAAAIIIIAAAggg4EMBGgB8WKhkCQEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABGgD4DCCAAAIIIIAAAggggAACCCCAAAIIIIAAAggg4EMBGgB8WKhkCQEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABGgD4DCCAAAIIIIAAAggggAACCCCAAAIIIIAAAggg4EMBGgB8WKhkCQEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABGgD4DCCAAAIIIIAAAggg
<p>The alignment of several tables can be achieved with the <code>combine</code> function (adapted from <code>gtable:::join</code>),</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">d1 &lt;-<span class="st"> </span>PlantGrowth[<span class="dv">1</span><span class="op">:</span><span class="dv">3</span>,<span class="dv">1</span>, drop=<span class="ot">FALSE</span>]
d2 &lt;-<span class="st"> </span>PlantGrowth[<span class="dv">1</span><span class="op">:</span><span class="dv">2</span>,<span class="dv">1</span><span class="op">:</span><span class="dv">2</span>]
g1 &lt;-<span class="st"> </span><span class="kw">tableGrob</span>(d1)
g2 &lt;-<span class="st"> </span><span class="kw">tableGrob</span>(d2)
haligned &lt;-<span class="st"> </span><span class="kw">gtable_combine</span>(g1,g2, <span class="dt">along=</span><span class="dv">1</span>)
valigned &lt;-<span class="st"> </span><span class="kw">gtable_combine</span>(g1,g2, <span class="dt">along=</span><span class="dv">2</span>)
<span class="kw">grid.newpage</span>()
<span class="kw">grid.arrange</span>(haligned, valigned, <span class="dt">ncol=</span><span class="dv">2</span>)</code></pre></div>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABIAAAAJACAYAAAD1kB3UAAAEDWlDQ1BJQ0MgUHJvZmlsZQAAOI2NVV1oHFUUPrtzZyMkzlNsNIV0qD8NJQ2TVjShtLp/3d02bpZJNtoi6GT27s6Yyc44M7v9oU9FUHwx6psUxL+3gCAo9Q/bPrQvlQol2tQgKD60+INQ6Ium65k7M5lpurHeZe58853vnnvuuWfvBei5qliWkRQBFpquLRcy4nOHj4g9K5CEh6AXBqFXUR0rXalMAjZPC3e1W99Dwntf2dXd/p+tt0YdFSBxH2Kz5qgLiI8B8KdVy3YBevqRHz/qWh72Yui3MUDEL3q44WPXw3M+fo1pZuQs4tOIBVVTaoiXEI/MxfhGDPsxsNZfoE1q66ro5aJim3XdoLFw72H+n23BaIXzbcOnz5mfPoTvYVz7KzUl5+FRxEuqkp9G/Ajia219thzg25abkRE/BpDc3pqvphHvRFys2weqvp+krbWKIX7nhDbzLOItiM8358pTwdirqpPFnMF2xLc1WvLyOwTAibpbmvHHcvttU57y5+XqNZrLe3lE/Pq8eUj2fXKfOe3pfOjzhJYtB/yll5SDFcSDiH+hRkH25+L+sdxKEAMZahrlSX8ukqMOWy/jXW2m6M9LDBc31B9LFuv6gVKg/0Szi3KAr1kGq1GMjU/aLbnq6/lRxc4XfJ98hTargX++DbMJBSiYMIe9Ck1YAxFkKEAG3xbYaKmDDgYyFK0UGYpfoWYXG+fAPPI6tJnNwb7ClP7IyF+D+bjOtCpkhz6CFrIa/I6sFtNl8auFXGMTP34sNwI/JhkgEtmDz14ySfaRcTIBInmKPE32kxyyE2Tv+thKbEVePDfW/byMM1Kmm0XdObS7oGD/MypMXFPXrCwOtoYjyyn7BV29/MZfsVzpLDdRtuIZnbpXzvlf+ev8MvYr/Gqk4H/kV/G3csdazLuyTMPsbFhzd1UabQbjFvDRmcWJxR3zcfH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AAgSAuAcQQAABBBBAAAEEEEAAAQQQQACBmAsQAIr5Beb0EEAAAQQQQAABBBBAAAEEEEAAAQJA3AMIIIAAAggggAACCCCAAAIIIIBAzAUIAMX8AnN6CCCAAAIIIIAAAggggAACCCCAAAEg7gEEEEAAAQQQQAABBBBAAAEEEEAg5gIEgGJ+gTk9BBBAAAEEEEAAAQQQQAABBBBAgAAQ9wACCCCAAAIIIIAAAggggAACCCAQcwECQDG/wJweAggggAACCCCAAAIIIIAAAgggQACIewABBBBAAAEEEEAAAQQQQAABBBCIuQABoJhfYE4PAQQQQAABBBBAAAEEEEAAAQQQIADEPYAAAggggAACCCCAAAIIIIAAAgjEXIAAUMwvMKeHAAIIIIAAAggggAACCCCAAAIIEADiHkAAAQQQQAABBBBAAAEEEEAAAQRiLkAAKOYXmNNDAAEEEEAAAQQQQAABBBBAAAEECABxDyCAAAIIIIAAAggggAACCCCAAAIxFyAAFPMLzOkhgAACCCCAAAIIIIAAAggggAACBIC4BxBAAAEEEEAAAQQQQAABBBBAAIGYCxAAivkF5vQQQAABBBBAAAEEEEAAAQQQQAABAkDcAwgggAACCCCAAAIIIIAAAggggEDMBQgAxfwCc3oIIIAAAggggAACCCCAAAIIIIAAASDuAQQQQAABBBBAAAEEEEAAAQQQQCDmAgSAYn6BOT0EEEAAAQQQQAABBBBAAAEEEECAABD3AAIIIIAAAggggAACCCCAAAIIIBBzAQJAMb/AnB4CCCCAAAIIIIAAAggggAACCCBAAIh7AAEEEEAAAQQQQAABBBBA
<div id="borders-and-separators" class="section level3">
<h3>Borders and separators</h3>
<p>Other grobs such as separating lines and rectangles (borders, boxes) may be added. In this case, keep in mind that row, column and cell numbering includes the column of row labels and the row of column labels <em>if they are present.</em> Let us illustrate this by adding some borders (using <code>rectGrob</code>) to a simple table without row numbers. Well add two actually, to give a nice effect of a heavy line under the row of column headers.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">library</span>(gtable)
g &lt;-<span class="st"> </span><span class="kw">tableGrob</span>(iris[<span class="dv">1</span><span class="op">:</span><span class="dv">4</span>, <span class="dv">1</span><span class="op">:</span><span class="dv">3</span>], <span class="dt">rows =</span> <span class="ot">NULL</span>)
g &lt;-<span class="st"> </span><span class="kw">gtable_add_grob</span>(g,
<span class="dt">grobs =</span> <span class="kw">rectGrob</span>(<span class="dt">gp =</span> <span class="kw">gpar</span>(<span class="dt">fill =</span> <span class="ot">NA</span>, <span class="dt">lwd =</span> <span class="dv">2</span>)),
<span class="dt">t =</span> <span class="dv">2</span>, <span class="dt">b =</span> <span class="kw">nrow</span>(g), <span class="dt">l =</span> <span class="dv">1</span>, <span class="dt">r =</span> <span class="kw">ncol</span>(g))
g &lt;-<span class="st"> </span><span class="kw">gtable_add_grob</span>(g,
<span class="dt">grobs =</span> <span class="kw">rectGrob</span>(<span class="dt">gp =</span> <span class="kw">gpar</span>(<span class="dt">fill =</span> <span class="ot">NA</span>, <span class="dt">lwd =</span> <span class="dv">2</span>)),
<span class="dt">t =</span> <span class="dv">1</span>, <span class="dt">l =</span> <span class="dv">1</span>, <span class="dt">r =</span> <span class="kw">ncol</span>(g))
<span class="kw">grid.draw</span>(g)</code></pre></div>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwAAAAGACAYAAAAargV/AAAEDWlDQ1BJQ0MgUHJvZmlsZQAAOI2NVV1oHFUUPrtzZyMkzlNsNIV0qD8NJQ2TVjShtLp/3d02bpZJNtoi6GT27s6Yyc44M7v9oU9FUHwx6psUxL+3gCAo9Q/bPrQvlQol2tQgKD60+INQ6Ium65k7M5lpurHeZe58853vnnvuuWfvBei5qliWkRQBFpquLRcy4nOHj4g9K5CEh6AXBqFXUR0rXalMAjZPC3e1W99Dwntf2dXd/p+tt0YdFSBxH2Kz5qgLiI8B8KdVy3YBevqRHz/qWh72Yui3MUDEL3q44WPXw3M+fo1pZuQs4tOIBVVTaoiXEI/MxfhGDPsxsNZfoE1q66ro5aJim3XdoLFw72H+n23BaIXzb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Ux4CS5cuNbNnzzbVqlUzTZo0MVtssYXnLLsQgEBlEaBuVhZ57gsBCEAAAqVKAAUgTcktXrzYjB492kydOtXMmjXLzJ8/PylkzZo1zbbbbmv+9Kc/mcMPP9xUrRrPwZRbbrnFTJw4McGmffv2pk+fPonf2e68/PLL5p133kkKftNNN5m6desmHeNHagIzZ840O+64Y8qTN998s/n8888T5zp27GiuuuqqxO9S26FuZldiFa2bV199tX3/ubupLj7++OOmSpUq7lDS9q677ipThxV2xIgRZvPNN08K634MGzbMjB071v20cT/22GOmXr16pqLpT0T6v51zzz036T3erVs385e//MUf
<p>Note that when using <code>rectGrob</code> the top, bottom, left and right arguments (<code>t, b, l, r</code>) are the rows and columns which will be <em>inside</em> the rectangle. If we repeat the above code almost exactly, but dont suppress the column of row labels, we see that column 1 is now the column of row labels (and it doesnt look that good either, but thats not our point).</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">g &lt;-<span class="st"> </span><span class="kw">tableGrob</span>(iris[<span class="dv">1</span><span class="op">:</span><span class="dv">4</span>, <span class="dv">1</span><span class="op">:</span><span class="dv">3</span>])
g &lt;-<span class="st"> </span><span class="kw">gtable_add_grob</span>(g,
<span class="dt">grobs =</span> <span class="kw">rectGrob</span>(<span class="dt">gp =</span> <span class="kw">gpar</span>(<span class="dt">fill =</span> <span class="ot">NA</span>, <span class="dt">lwd =</span> <span class="dv">2</span>)),
<span class="dt">t =</span> <span class="dv">2</span>, <span class="dt">b =</span> <span class="kw">nrow</span>(g), <span class="dt">l =</span> <span class="dv">1</span>, <span class="dt">r =</span> <span class="kw">ncol</span>(g))
g &lt;-<span class="st"> </span><span class="kw">gtable_add_grob</span>(g,
<span class="dt">grobs =</span> <span class="kw">rectGrob</span>(<span class="dt">gp =</span> <span class="kw">gpar</span>(<span class="dt">fill =</span> <span class="ot">NA</span>, <span class="dt">lwd =</span> <span class="dv">2</span>)),
<span class="dt">t =</span> <span class="dv">1</span>, <span class="dt">l =</span> <span class="dv">1</span>, <span class="dt">r =</span> <span class="kw">ncol</span>(g))
<span class="kw">grid.draw</span>(g)</code></pre></div>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwAAAAGACAYAAAAargV/AAAEDWlDQ1BJQ0MgUHJvZmlsZQAAOI2NVV1oHFUUPrtzZyMkzlNsNIV0qD8NJQ2TVjShtLp/3d02bpZJNtoi6GT27s6Yyc44M7v9oU9FUHwx6psUxL+3gCAo9Q/bPrQvlQol2tQgKD60+INQ6Ium65k7M5lpurHeZe58853vnnvuuWfvBei5qliWkRQBFpquLRcy4nOHj4g9K5CEh6AXBqFXUR0rXalMAjZPC3e1W99Dwntf2dXd/p+tt0YdFSBxH2Kz5qgLiI8B8KdVy3YBevqRHz/qWh72Yui3MUDEL3q44WPXw3M+fo1pZuQs4tOIBVVTaoiXEI/MxfhGDPsxsNZfoE1q66ro5aJim3XdoLFw72H+n23BaIXzbcOnz5mfPoTvYVz7KzUl5+FRxEuqkp9G/Ajia219thzg25abkRE/BpDc3pqvphHvRFys2weqvp+krbWKIX7nhDbzLOItiM8358pTwdirqpPFnMF2xLc1WvLyOwTAibpbmvHHcvttU57y5+XqNZrLe3lE/Pq8eUj2fXKfOe3pfOjzhJYtB/yll5SDFcSDiH+hRkH25+L+sdxKEAMZahrlSX8ukqMOWy/jXW2m6M9LDBc31B9LFuv6gVKg/0Szi3KAr1kGq1GMjU/aLbnq6/lRxc4XfJ98hTargX++DbMJBSiYMIe9Ck1YAxFkKEAG3xbYaKmDDgYyFK0UGYpfoWYXG+fAPPI6tJnNwb7ClP7IyF+D+bjOtCpkhz6CFrIa/I6sFtNl8auFXGMTP34sNwI/JhkgEtmDz14ySfaRcTIBInmKPE32kxyyE2Tv+thKbEVePDfW/byMM1Kmm0XdObS7oGD/MypMXFPXrCwOtoYjyyn7BV29/MZfsVzpLDdRtuIZnbpXzvlf+ev8MvYr/Gqk4H/kV/G3csdazLuyTMPsbFhzd1UabQbjFvDRmcWJxR3zcfHkVw9GfpbJ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NGjUzjxo3NmDFjTJwvzyRzJW/pJdCyZUuzxhpr2O/cjBkzzIQJE9ILg5xDICYC/fv3N8OHD48ptn+iiV0BaN68uWnXrl2smQwjMqcATJ061cyZMyeMIAkDAhCoJYG2bduaJZZYwjRp0sTMnj3b/PHHH7UMkdshkG4Cyy23nP1Gq6Nr2rRpRt8+BAIQiJZA06ZNo40gIHQmAQdA4RAEIAABCEAAAhCAAASSSgAFIKklS74gAAEIQAACEIAABCAQQAAFIAAKhyAAAQhAAAIQgAAEIJBUAigASS1Z8gUBCEAAAhCAAAQgAIEAAigAAVA4BAEIQAACEIAABCAAgaQSQAFIasmSLwhAAAIQgAAEIAABCAQQQAEIgMIhCEAAAhCAAAQgAAEIJJUACkBSS5Z8QQACEIAABCAAAQhAIIAACkAAFA5BAAIQgAAEIAABCEAgqQRQAJJasuQLAhCAAAQgAAEIQAACAQRQAAKgcAgCEIAABCAAAQhAAAJJJVA/qRmrtHz99ddfZuLEiaZevXpmhRVWMC1atKi0LJBeCCSSAHUzkcVKpiAAAQikmgAKQImKf/r06eaJJ54wY8aMMRMmTDC//vprVkoaNmxoVlllFXPwwQebXXbZxdStm87BmiuuuMJ8/PHHGTadOnUyvXr1yvwudue5554zr7/+etbll112mWnatGnWMX4EExg/frxZY401Ak9efvnl5pNPPsmc22qrrcy5556b+V1pO9TN4kqstnXzvPPOs+8/F5vq4gMPPGDq1KnjDmVtb7zxxip1WNcOHDjQLLPMMlnXuh933XWXefHFF91PG/b9999vmjVr
<p>When adding line segments to separate rows and columns using <code>segmentsGrob</code>, the row and column numbering scheme is the same (it includes any row or column labels). When working with line segments, you should keep in mind the default coordinate values for <code>segmentsGrob</code>. They are x0 = 0, y0 = 0, x1 = 1, y1 = 1, all in npc, relative to the cell(s) you are modifying, with the lower left corner being 0,0. For clarity, we show all the arguments in these examples. With this in mind, to add a line across the bottom of a single cell, use:</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">g &lt;-<span class="st"> </span><span class="kw">tableGrob</span>(iris[<span class="dv">1</span><span class="op">:</span><span class="dv">4</span>, <span class="dv">1</span><span class="op">:</span><span class="dv">3</span>])
g &lt;-<span class="st"> </span><span class="kw">gtable_add_grob</span>(g,
<span class="dt">grobs =</span> <span class="kw">segmentsGrob</span>( <span class="co"># line across the bottom</span>
<span class="dt">x0 =</span> <span class="kw">unit</span>(<span class="dv">0</span>,<span class="st">&quot;npc&quot;</span>),
<span class="dt">y0 =</span> <span class="kw">unit</span>(<span class="dv">0</span>,<span class="st">&quot;npc&quot;</span>),
<span class="dt">x1 =</span> <span class="kw">unit</span>(<span class="dv">1</span>,<span class="st">&quot;npc&quot;</span>),
<span class="dt">y1 =</span> <span class="kw">unit</span>(<span class="dv">0</span>,<span class="st">&quot;npc&quot;</span>),
<span class="dt">gp =</span> <span class="kw">gpar</span>(<span class="dt">lwd =</span> <span class="fl">2.0</span>)),
<span class="dt">t =</span> <span class="dv">3</span>, <span class="dt">b =</span> <span class="dv">3</span>, <span class="dt">l =</span> <span class="dv">3</span>, <span class="dt">r =</span> <span class="dv">3</span>)
<span class="kw">grid.draw</span>(g)</code></pre></div>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwAAAAGACAYAAAAargV/AAAEDWlDQ1BJQ0MgUHJvZmlsZQAAOI2NVV1oHFUUPrtzZyMkzlNsNIV0qD8NJQ2TVjShtLp/3d02bpZJNtoi6GT27s6Yyc44M7v9oU9FUHwx6psUxL+3gCAo9Q/bPrQvlQol2tQgKD60+INQ6Ium65k7M5lpurHeZe58853vnnvuuWfvBei5qliWkRQBFpquLRcy4nOHj4g9K5CEh6AXBqFXUR0rXalMAjZPC3e1W99Dwntf2dXd/p+tt0YdFSBxH2Kz5qgLiI8B8KdVy3YBevqRHz/qWh72Yui3MUDEL3q44WPXw3M+fo1pZuQs4tOIBVVTaoiXEI/MxfhGDPsxsNZfoE1q66ro5aJim3XdoLFw72H+n23BaIXzbcOnz5mfPoTvYVz7KzUl5+FRxEuqkp9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EAgJgIoADGBDkbzxx9/mMcee8wMGzbMjBw50vz88895l7Ru3dosssgiZo899jBbbLGFad48m4M1F1xwgXn//fdzbLp3725OP/303O9Kd5599lnzyiuv5F1+3nnnmfbt2+cd40dhAiNGjDBLLrlkwZPnn3+++eCDD3Ln1l13XXPKKafkftfbDmWzshxratk89dRT7ffPxaayeO+995pmzZq5Q3nbq6++ukEZ1rV9+/Y1c801V9617sctt9xi+vXr537asO+55x7ToUMH09T05wL9386hhx6a9x3v0aOH2WeffYKX5X5P
<p>and to add a line to the left side:</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">g &lt;-<span class="st"> </span><span class="kw">tableGrob</span>(iris[<span class="dv">1</span><span class="op">:</span><span class="dv">4</span>, <span class="dv">1</span><span class="op">:</span><span class="dv">3</span>])
g &lt;-<span class="st"> </span><span class="kw">gtable_add_grob</span>(g,
<span class="dt">grobs =</span> <span class="kw">segmentsGrob</span>( <span class="co"># line across the bottom</span>
<span class="dt">x0 =</span> <span class="kw">unit</span>(<span class="dv">0</span>,<span class="st">&quot;npc&quot;</span>),
<span class="dt">y0 =</span> <span class="kw">unit</span>(<span class="dv">0</span>,<span class="st">&quot;npc&quot;</span>),
<span class="dt">x1 =</span> <span class="kw">unit</span>(<span class="dv">0</span>,<span class="st">&quot;npc&quot;</span>),
<span class="dt">y1 =</span> <span class="kw">unit</span>(<span class="dv">1</span>,<span class="st">&quot;npc&quot;</span>),
<span class="dt">gp =</span> <span class="kw">gpar</span>(<span class="dt">lwd =</span> <span class="fl">2.0</span>)),
<span class="dt">t =</span> <span class="dv">3</span>, <span class="dt">b =</span> <span class="dv">3</span>, <span class="dt">l =</span> <span class="dv">3</span>, <span class="dt">r =</span> <span class="dv">3</span>)
<span class="kw">grid.draw</span>(g)</code></pre></div>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwAAAAGACAYAAAAargV/AAAEDWlDQ1BJQ0MgUHJvZmlsZQAAOI2NVV1oHFUUPrtzZy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gAAEIFBmAigAZS4AoocABCAAAQhAAAIQgECYBFAAwqRNXBCAAAQgAAEIQAACECgzARSAMhcA0UMAAhCAAAQgAAEIQCBMAigAYdImLghAAAIQgAAEIAABCJSZAApAmQuA6CEAAQhAAAIQgAAEIBAmARSAMGkTFwQgAAEIQAACEIAABMpMAAWgzAVA9BCAAAQgAAEIQAACEAiTAApAmLSJCwIQgAAEIAABCEAAAmUmgAJQ5gIgeghAAAIQgAAEIAABCIRJAAUgTNrEBQEIQAACEIAABCAAgTITQAEocwEQPQQgAAEIQAACEIAABMIkUDfMyIgrO4G///7bjB8/3tSpU8csv/zypmXLltkv5hcIQCA0AtTN0FATEQQgAAEIhEQABSAk0P5o/vzzT/Pss8+aUaNGmXHjxpkpU6akXVK/fn2zyiqrmEMOOcTstttupnbtZE7WXHPNNebzzz9PsenUqZO5+OKLU98LPXjllVfMO++8k3b5VVddZZo0aZJ2ji+ZCYwdO9asueaaGX+8+uqrzRdffJH6bZtttjEXXHBB6nulHVA3CyuxmtbNCy+80L7/XGyqi48++qipVauWO5X2eeutt1apw7r2gQceMMsuu2zate7LPffcYwYNGuS+2rAfeeQR07RpU1PT9KcC/efghBNOSHuPd+vWzRxxxBH+y1Lf586d
<p>Perhaps youd like to cross out a cell. This can be done with two diagonal lines combined via a <code>grobTree</code>:</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">g &lt;-<span class="st"> </span><span class="kw">tableGrob</span>(iris[<span class="dv">1</span><span class="op">:</span><span class="dv">4</span>, <span class="dv">1</span><span class="op">:</span><span class="dv">3</span>])
g &lt;-<span class="st"> </span><span class="kw">gtable_add_grob</span>(g,
<span class="dt">grobs =</span> <span class="kw">grobTree</span>(
<span class="kw">segmentsGrob</span>( <span class="co"># diagonal line ul -&gt; lr</span>
<span class="dt">x0 =</span> <span class="kw">unit</span>(<span class="dv">0</span>,<span class="st">&quot;npc&quot;</span>),
<span class="dt">y0 =</span> <span class="kw">unit</span>(<span class="dv">1</span>,<span class="st">&quot;npc&quot;</span>),
<span class="dt">x1 =</span> <span class="kw">unit</span>(<span class="dv">1</span>,<span class="st">&quot;npc&quot;</span>),
<span class="dt">y1 =</span> <span class="kw">unit</span>(<span class="dv">0</span>,<span class="st">&quot;npc&quot;</span>),
<span class="dt">gp =</span> <span class="kw">gpar</span>(<span class="dt">lwd =</span> <span class="fl">2.0</span>)),
<span class="kw">segmentsGrob</span>( <span class="co"># diagonal line ll -&gt; ur</span>
<span class="dt">x0 =</span> <span class="kw">unit</span>(<span class="dv">0</span>,<span class="st">&quot;npc&quot;</span>),
<span class="dt">y0 =</span> <span class="kw">unit</span>(<span class="dv">0</span>,<span class="st">&quot;npc&quot;</span>),
<span class="dt">x1 =</span> <span class="kw">unit</span>(<span class="dv">1</span>,<span class="st">&quot;npc&quot;</span>),
<span class="dt">y1 =</span> <span class="kw">unit</span>(<span class="dv">1</span>,<span class="st">&quot;npc&quot;</span>),
<span class="dt">gp =</span> <span class="kw">gpar</span>(<span class="dt">lwd =</span> <span class="fl">2.0</span>))),
<span class="dt">t =</span> <span class="dv">3</span>, <span class="dt">b =</span> <span class="dv">3</span>, <span class="dt">l =</span> <span class="dv">3</span>, <span class="dt">r =</span> <span class="dv">3</span>)
<span class="kw">grid.draw</span>(g)</code></pre></div>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwAAAAGACAYAAAAargV/AAAEDWlDQ1BJQ0MgUHJvZmlsZQAAOI2NVV1oHFUUPrtzZyMkzlNsNIV0qD8NJQ2TVjShtLp/3d02bpZJNtoi6GT27s6Yyc44M7v9oU9FUHwx6psUxL+3gCAo9Q/bPrQvlQol2tQgKD60+INQ6Ium65k7M5lpurHeZe58853vnnvuuWfvBei5qliWkRQBFpquLRcy4nOHj4g9K5CEh6AXBqFXUR0rXalMAjZPC3e1W99Dwntf2dXd/p+tt0YdFSBxH2Kz5qgLiI8B8KdVy3YBevqRHz/qWh72Yui3MUDEL3q44WPXw3M+fo1pZuQs4tOIBVVTaoiX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E1oeHJk1RsWAviIoKKooVFXvvinrtDdu194L12hv23nvvFUXsKILYFRRQwQZSbBRB+Hjm3tlvNu/2N8lmN//z+73vZrPJZOaZTHLOzJkzTWbNFiMRAREQAREQAREQAREQARFIBYGmqSilCikCIiACIiACIiACIiACImAJyADQjSACIiACIiACIiACIiACKSIgAyBFla2iioAIiIAIiIAIiIAIiIAMAN0DIiACIiACIiACIiACIpAiAjIAUlTZKqoIiIAIiIAIiIAIiIAIyADQPSACIiACIiACIiACIiACKSIgAyBFla2iioAIiIAIiIAIiIAIiIAMAN0DIiACIiACIiACIiACIpAiAjIAUlTZKqoIiIAIiIAIiIAIiIAIyADQPSACIiACIiACIiACIiACKSIgAyBFla2iioAIiIAIiIAIiIAIiIAMAN0DIiACIiACIiACIiACIpAiAjIAUlTZKqoIiIAIiIAIiIAIiIAIyADQPSACIiACIiACIiACIiACKSIgAyBFla2iioAIiIAIiIAIiIAIiIAMAN0DIiACIiACIiACIiACIpAiAjIAUlTZKqoIiIAIiIAIiIAIiIAIyADQPSACIiACIiACIiACIiACKSIgAyBFla2iioAIiIAIiIAIiIAIiIAMAN0DIiACIiACIiACIiACIpAiAjIAUlTZKqoIiIAIiIAIiIAIiIAIyADQPSACIiACIiACIiACIiACKSIgAyBFla2iioAIiIAIiIAIiIAIiIAMAN0DIiACIiACIiACIiACIpAiAjIAUlTZKqoIiIAIiIAIiIAIiIAIyADQPSACIiACIiACIiACIiACKSIgAyBFla2iioAIiIAIiIAIiIAIiIAMAN0DIiACIiACIiACIiACIpAiAjIAUlTZKqoIiIAIiIAIiIAIiIAIyADQPSACIiACIiACIiACIiACKSIgAyBFla2iioAIiIAIiIAIiIAIiIAMAN0DIiACIiACIiACIiACIpAiAjIAUlTZKqoIiIAIiIAIiIAIiIAIyADQPSACIiACIiACIiACIiACKSIgAyBFla2iioAIiIAIiIAIiIAIiIAMAN0DIiACIiACIiACIiACIpAiAjIAUlTZKqoIiIAIiIAIiIAIiIAIyADQPSACIiACIiACIiACIiACKSIgAyBFla2iioAIiIAIiIAIiIAIiIAMAN0DIiACIiACIiACIiACIpAiAjIAUlTZKqoIiIAIiIAIiIAIiIAIyADQPSACIiACIiACIiACIiACKSIgAyBFla2iioAIiIAIiIAIiIAIiIAMAN0DIiACIiACIiACIiACIpAiAjIAUlTZKqoIiIAIiIAIiIAIiIAIyADQPSACIiACIiACIiACIiACKSIgAyBFla2iioAIiIAIiIAIiIAIiIAMAN0DIiACIiACIiACIiACIpAiAjIAUlTZKqoIiIAIiIAIiIAIiIAIyADQPSACIiACIiACIiACIiACKSIgAyBFla2iioAIiIAIiIAIiIAIiIAMAN0DIiACIiACIiACIiACIpAiAjIAUlTZKqoIiIAIiIAIiIAIiIAIyADQPSACIiACIiACIiACIiACKSIgAyBFla2iioAIiIAIiIAIiIAIiIAMAN0DIiACIiACIiACIiACIpAiAjIAUlTZKqoIiIAIiIAIiIAIiIAIyADQPSACIiACIiACIiACIiACKSLQPEVlbVRRp0+fbmbOnNmoNHSyCIhA+AT++ecf06xZs/ATVooikGICalcprnwVvWoEmjZtalq0aBHL9WUAlIh51qxZpmXLlmb8+PFmxowZJZ6lw0RABKIkMM8889jkaZuTJk0y06ZNi/JySlsE6p5A69atTbt27WxbotPr999/r/syq4AiUG0CdGLNP//85u+//44tKzIAykQ9YsQIM3Xq1DLP0uEiIAJREOjSpYtp1aqVTXr06NFm4sSJUVxGaYpAaggsuOCC1gCgwCj/w4YNS03ZVVARqBYBOrEwAOIUzQGIk7auJQIiIAIiIAIiIAIiIAJVJiADoMoVoMuLgAiIgAiIgAiIgAiIQJwEZADESVvXEgEREAEREAEREAEREIEqE5ABUOUK0OVFQAREQAREQAREQAREIE4CMgDipK1riYAIiIAIiIAIiIAIiECVCcgAqHIF6PIiIAIiIAIiIAIiIAIiECcBGQBx0ta1REAEREAEREAEREAERKDKBGQAVLkCdHkREAEREAEREAEREAERiJOADIA4aetaIiACIiACIiACIiACIlBlAjIAqlwBurwIiIAIiIAIiIAIiIAIxElABkCctHUtERABERABERABERABEagyARkAVa4AXV4EREAEREAEREAEREAE4iTQPM6L6Vr5Cfz5559m1KhRplmzZmahhRYy7du3z3+wfhEBEYiNgNpmbKh1IREQAREQgZgIyACICXTwMr/99pt5/PHHzbBhw8zIkSPN2LFjsw6ZY445zBJLLGF22203s9lmm5mmTdM5WHP++eebwYMHZ9istdZa5rTTTst8L3XjueeeM6+//nrW4eeee65p27Zt1j59yU1gxIgRZplllsn543nnnWc+/PDDzG/rrruuOfnk
<p>If you have many cells to decorate you can use <code>replicate</code> to create create the segments. Just keep the <code>tableGrob</code> numbering scheme in mind.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">g &lt;-<span class="st"> </span><span class="kw">tableGrob</span>(<span class="kw">head</span>(iris), <span class="dt">theme =</span> <span class="kw">ttheme_minimal</span>())
separators &lt;-<span class="st"> </span><span class="kw">replicate</span>(<span class="kw">ncol</span>(g) <span class="op">-</span><span class="st"> </span><span class="dv">2</span>,
<span class="kw">segmentsGrob</span>(<span class="dt">x1 =</span> <span class="kw">unit</span>(<span class="dv">0</span>, <span class="st">&quot;npc&quot;</span>), <span class="dt">gp=</span><span class="kw">gpar</span>(<span class="dt">lty=</span><span class="dv">2</span>)),
<span class="dt">simplify=</span><span class="ot">FALSE</span>)
## add vertical lines on the left side of columns (after 2nd)
g &lt;-<span class="st"> </span>gtable<span class="op">::</span><span class="kw">gtable_add_grob</span>(g, <span class="dt">grobs =</span> separators,
<span class="dt">t =</span> <span class="dv">2</span>, <span class="dt">b =</span> <span class="kw">nrow</span>(g), <span class="dt">l =</span> <span class="kw">seq_len</span>(<span class="kw">ncol</span>(g)<span class="op">-</span><span class="dv">2</span>)<span class="op">+</span><span class="dv">2</span>)
<span class="kw">grid.draw</span>(g)</code></pre></div>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABgAAAAGACAYAAABr+ak9AAAEDWlDQ1BJQ0MgUHJvZmlsZQAAOI2NVV1oHFUUPrtzZyMkzlNsN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kdVm9NOL5BE4wkQ2SMlDZU97hX86EilU/lUmkQUztTE6mx1EEPh7OmdqBtAvv8HdWpbrJS6tJj3n0CWdM6busNzRV3S9KTYhqvNiqWmuroiKgYhshMjmhTh9ptWhsF7970j/SbMrsPE1suR5z7DMC+P/Hs+y7ijrQAlhyAgccjbhjPygfeBTjzhNqy28EdkUh8C+DU9+z2v/oyeH791OncxHOs5y2AtTc7nb/f73TWPkD/qwBnjX8BoJ98VVBg/m8AAEAASURBVHgB7J0J/FVD/8fHln17lOUJeZItiSxlCZU9InvhQZTQQiRZE6FCESW7UMpWSagkW8gjWxuRIknhiShLOP/vZx5z/nO2e8+999zf795zP/N6/X7n3HNm5sy8z5lzZub7ne93NUeCYiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEkgVgdVTVRtWhgRIgARIgARIgARIgARIgARIgARIgARIgARIgARIgARIQBOgAIAPAgmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmkkAAFACm8qawSCZAACZAACZAACZAACZAACZAACZAACZAACZAACZAACVAAwGeABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABFJIgAKAFN5UVokESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAEKADgM0ACJEACJEACJEACJEACJEACJEACJEACJEACJEACJEACKSRAAUAKbyqrRAIkQAIkQAIkQAIkQAIkQAIkQAIkQAIkQAIkQAIkQAIUAPAZIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIIEUEqAAIIU3lVUiARIgARIgARIgARIgARIgARIgARIgARIgARIgARIgAQoA+AyQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQQAoJUACQwpvKKpEACZAACZAACZAACZAACZAACZAACZAACZAACZAACZAABQB8BkiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEgghQQoAEjhTWWVSIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESIACAD4DJEACJEACJEACJEACJEACJEACJEACJEACJEACJEACJJBCAhQApPCmskokQAIkQAIkQAIkQAIkQAIkQAIkQAIkQAIkQAIkQAIkQAEAnwESIAESIAESIAESIAESIAESIAESIAESIAESIAESIAESSCEBCgBSeFNZJRIgARIgARIgARIgARIgARIgARIgARIgARIgARIgARKgAIDPAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmkkAAFACm8qawSCZAACZAACZAACZAACZAACZAACZAACZAACZAACZAACVAAwGeABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABFJIYM0U1olVIgESqBACP/74o5o5c6Zac8011Xbbbae22GKLCqk5q0kCpU3gr7/+UvPmzVMLFy5UtWvXVnXq1FHrrLNOaReapSMBEiABEiABEiABEsibAPt/eaNjQhIgARIoOgGuACg6Yl6ABEggKQLff/+96tWrlzrmmGP0hOImm2yimjZtqvbdd1+15ZZbqvXWW081atRIPfroowod0EoN//73vzUPMMFfu3bt8kJx//33qyOPPNLzt3z58rzyqsREK1euVJ9//nlo1U877TTPPerQoUNovHI6OH78eHXOOeeoffbZR22wwQZqxx13VIcccojaeeedddv85z//qZ/FBQsWlFO1Ei3rhx9+6LnvaJ+zZs2KfQ28+0y7xnannXZSjuNEpu/SpYsnPtJstdVWaunSpZFprrjiCk8a3DcIWxEKLb//onhW7Pr069fPH8XzO1Obeu+99zx5Id9PPvnEk74cfuBdYDOx93HvttlmG1WvXj1Vv359/e1r06aNuv3221V1vJsz3Y+kWCfxPfv111893zF814YMGZJUESsinxkzZoTWMy3tDu8Ku6359/EehKIJ3rkNGzbUz1OnTp3UW2+9FcqlmAfLod1V97cqifeGfQ+T/Fax/2eTrZz9pPtPlUOONSUBEkiUgAwcGUiABEig5AmMHj3a+cc//oGZrlh/MjniTJ06teTrVYwCysDLw6h169Z5XaZ79+6efMD+u+++yyuvSkv0+OOPOzJR59x9992hVZcJKA/bk046KTReORz8+eefnVatWnnqk6md1qhRw5GJaeePP/4oh+olWsZ33303wOmDDz6IfY1LLrkkkP7jjz+OTL/11lsH4uPejBo1KjLN3nvv7Umz6667unELLb+b0d87MqHmudbVV1/tj+L+ztam3n77bU9eqKesEHPTl8sO3gWZ2k/UuY022sh54oknqqya2e5HUgVJ4nuGd5SfW+fOnZMqYqrzWbRokSOTqY4In0LrmZZ2h3eF/xmJ+/uII45wRAAXyifpg+XS7qr7W5XEe8O+d0l+q9j/Y//PvFty6f/ZzyP3SYAESCBfAlwBIG9gBhIggdIm8Morr6hTTz1V/fe//41d0NmzZyuZ+FZff/117DSMSAKFEnj//ffVQQcdpNq2bavN3xSaX6mn//PPP5VMWKpx48bFLurvv/+u7rzzTr2aJ3YiRtQEDjzwwAAJmYALHMMBEQyor776KvQc3qlhAZrS0FKzA57n6gyV1qbyZY0VAHjvjBw5Mt8sYqXj/YiFqewj/fbbb6pv375a473SV1Vmu5kTJkxQhx56qIJmfrFCubU7fqsWFutRKJl82f8rmVvBgpAACZBAbAL0ARAbFSOSAAlUBwGRbqoLL7xQYdLQDptttpmeaBUNVz3o
</div>
<div id="accessing-existing-grobs-in-the-table" class="section level3">
<h3>Accessing existing grobs in the table</h3>
<p>We may also access and modify the original content of individual cells, e.g. to highlight a value.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">g &lt;-<span class="st"> </span><span class="kw">tableGrob</span>(iris[<span class="dv">1</span><span class="op">:</span><span class="dv">4</span>, <span class="dv">1</span><span class="op">:</span><span class="dv">3</span>])
find_cell &lt;-<span class="st"> </span><span class="cf">function</span>(table, row, col, <span class="dt">name=</span><span class="st">&quot;core-fg&quot;</span>){
l &lt;-<span class="st"> </span>table<span class="op">$</span>layout
<span class="kw">which</span>(l<span class="op">$</span>t<span class="op">==</span>row <span class="op">&amp;</span><span class="st"> </span>l<span class="op">$</span>l<span class="op">==</span>col <span class="op">&amp;</span><span class="st"> </span>l<span class="op">$</span>name<span class="op">==</span>name)
}
ind &lt;-<span class="st"> </span><span class="kw">find_cell</span>(g, <span class="dv">3</span>, <span class="dv">2</span>, <span class="st">&quot;core-fg&quot;</span>)
ind2 &lt;-<span class="st"> </span><span class="kw">find_cell</span>(g, <span class="dv">2</span>, <span class="dv">3</span>, <span class="st">&quot;core-bg&quot;</span>)
g<span class="op">$</span>grobs[ind][[<span class="dv">1</span>]][[<span class="st">&quot;gp&quot;</span>]] &lt;-<span class="st"> </span><span class="kw">gpar</span>(<span class="dt">fontsize=</span><span class="dv">15</span>, <span class="dt">fontface=</span><span class="st">&quot;bold&quot;</span>)
g<span class="op">$</span>grobs[ind2][[<span class="dv">1</span>]][[<span class="st">&quot;gp&quot;</span>]] &lt;-<span class="st"> </span><span class="kw">gpar</span>(<span class="dt">fill=</span><span class="st">&quot;darkolivegreen1&quot;</span>, <span class="dt">col =</span> <span class="st">&quot;darkolivegreen4&quot;</span>, <span class="dt">lwd=</span><span class="dv">5</span>)
<span class="kw">grid.draw</span>(g)</code></pre></div>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwAAAAGACAYAAAAargV/AAAEDWlDQ1BJQ0MgUHJvZmlsZQAAOI2NVV1oHFUUPrtzZyMkzlNsNIV0qD8NJQ2TVjShtLp/3d02bpZJNtoi6GT27s6Yyc44M7v9oU9FUHwx6psUxL+3gCAo9Q/bPrQvlQol2tQgKD60+INQ6Ium65k7M5lpurHeZe58853vnnvuuWfvBei5qliWkRQBFpquLRcy4nOHj4g9K5CEh6AXBqFXUR0rXalMAjZPC3e1W99Dwntf2dXd/p+tt0YdFSBxH2Kz5qgLiI8B8KdVy3YBevqRHz/qWh72Yui3MUDEL3q44WPXw3M+fo1pZuQs4tOIBVVTaoiXEI/MxfhGDPsxsNZfoE1q66ro5aJim3XdoLFw72H+n23BaIXzbcOnz5mfPoTvYVz7KzUl5+FRxEuqkp9G/Ajia219thzg25abkRE/BpDc3pqvphHvRFys2weqvp+krbWKIX7nhDbzLOItiM8358pTwdirqpPFnMF2xLc1WvLyOwTAibpbmvHHcvttU57y5+XqNZrLe3lE/Pq8eUj2fXKfOe3pfOjzhJYtB/yll5SDFcSDiH+hRkH25+L+sdxKEAMZah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1WFde+edd9q8886bda3fueWWW+yll17yuy7s++67z9q3b2+NTX8m0P9uHHrooVnv8T59+tjee+8dviyzP23aNBs3bpwtuOCCmWN+
</div>
</div>
<div id="faster-tables-an-alternative-grid-function" class="section level2">
<h2>Faster tables: an alternative grid function</h2>
<p>The <code>tableGrob</code> function can be very slow; unfortunately this is the price to pay for its versatility and easier implementation. We use individual <code>textGrob</code> and <code>rectGrob</code> elements for each cell, instead of relying on the vectorised implementation of these functions. The reason is practical: it is much easier to place, measure, and customise individual grobs, than modify the graphical parameters and positions of a single vectorised grob. An alternative function is presented below, using this vectorised approach, but lacking many of the customisations of <code>tableGrob</code>.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">grid.ftable &lt;-<span class="st"> </span><span class="cf">function</span>(d, <span class="dt">padding =</span> <span class="kw">unit</span>(<span class="dv">4</span>, <span class="st">&quot;mm&quot;</span>), ...) {
nc &lt;-<span class="st"> </span><span class="kw">ncol</span>(d)
nr &lt;-<span class="st"> </span><span class="kw">nrow</span>(d)
## character table with added row and column names
extended_matrix &lt;-<span class="st"> </span><span class="kw">cbind</span>(<span class="kw">c</span>(<span class="st">&quot;&quot;</span>, <span class="kw">rownames</span>(d)),
<span class="kw">rbind</span>(<span class="kw">colnames</span>(d),
<span class="kw">as.matrix</span>(d)))
## string width and height
w &lt;-<span class="st"> </span><span class="kw">apply</span>(extended_matrix, <span class="dv">2</span>, strwidth, <span class="st">&quot;inch&quot;</span>)
h &lt;-<span class="st"> </span><span class="kw">apply</span>(extended_matrix, <span class="dv">2</span>, strheight, <span class="st">&quot;inch&quot;</span>)
widths &lt;-<span class="st"> </span><span class="kw">apply</span>(w, <span class="dv">2</span>, max)
heights &lt;-<span class="st"> </span><span class="kw">apply</span>(h, <span class="dv">1</span>, max)
padding &lt;-<span class="st"> </span><span class="kw">convertUnit</span>(padding, <span class="dt">unitTo =</span> <span class="st">&quot;in&quot;</span>, <span class="dt">valueOnly =</span> <span class="ot">TRUE</span>)
x &lt;-<span class="st"> </span><span class="kw">cumsum</span>(widths <span class="op">+</span><span class="st"> </span>padding) <span class="op">-</span><span class="st"> </span><span class="fl">0.5</span> <span class="op">*</span><span class="st"> </span>padding
y &lt;-<span class="st"> </span><span class="kw">cumsum</span>(heights <span class="op">+</span><span class="st"> </span>padding) <span class="op">-</span><span class="st"> </span>padding
rg &lt;-<span class="st"> </span><span class="kw">rectGrob</span>(<span class="dt">x =</span> <span class="kw">unit</span>(x <span class="op">-</span><span class="st"> </span>widths<span class="op">/</span><span class="dv">2</span>, <span class="st">&quot;in&quot;</span>),
<span class="dt">y =</span> <span class="kw">unit</span>(<span class="dv">1</span>, <span class="st">&quot;npc&quot;</span>) <span class="op">-</span><span class="st"> </span><span class="kw">unit</span>(<span class="kw">rep</span>(y, <span class="dt">each =</span> nc <span class="op">+</span><span class="st"> </span><span class="dv">1</span>), <span class="st">&quot;in&quot;</span>),
<span class="dt">width =</span> <span class="kw">unit</span>(widths <span class="op">+</span><span class="st"> </span>padding, <span class="st">&quot;in&quot;</span>),
<span class="dt">height =</span> <span class="kw">unit</span>(heights <span class="op">+</span><span class="st"> </span>padding, <span class="st">&quot;in&quot;</span>))
tg &lt;-<span class="st"> </span><span class="kw">textGrob</span>(<span class="kw">c</span>(<span class="kw">t</span>(extended_matrix)), <span class="dt">x =</span> <span class="kw">unit</span>(x <span class="op">-</span><span class="st"> </span>widths<span class="op">/</span><span class="dv">2</span>, <span class="st">&quot;in&quot;</span>),
<span class="dt">y =</span> <span class="kw">unit</span>(<span class="dv">1</span>, <span class="st">&quot;npc&quot;</span>) <span class="op">-</span><span class="st"> </span><span class="kw">unit</span>(<span class="kw">rep</span>(y, <span class="dt">each =</span> nc <span class="op">+</span><span class="st"> </span><span class="dv">1</span>), <span class="st">&quot;in&quot;</span>),
<span class="dt">just =</span> <span class="st">&quot;center&quot;</span>)
g &lt;-<span class="st"> </span><span class="kw">gTree</span>(<span class="dt">children =</span> <span class="kw">gList</span>(rg, tg), ...,
<span class="dt">x =</span> x, <span class="dt">y =</span> y, <span class="dt">widths =</span> widths, <span class="dt">heights =</span> heights)
<span class="kw">grid.draw</span>(g)
<span class="kw">invisible</span>(g)
}
<span class="kw">grid.newpage</span>()
<span class="kw">grid.ftable</span>(<span class="kw">head</span>(iris, <span class="dv">4</span>), <span class="dt">gp =</span> <span class="kw">gpar</span>(<span class="dt">fill =</span> <span class="kw">rep</span>(<span class="kw">c</span>(<span class="st">&quot;grey90&quot;</span>, <span class="st">&quot;grey95&quot;</span>), <span class="dt">each =</span> <span class="dv">6</span>)))</code></pre></div>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABIAAAAGACAYAAADVkBn9AAAEDWlDQ1BJQ0MgUHJvZmlsZQAAOI2NVV1oHFUUPrtzZyMkzlNsNIV0qD8NJQ2TVjShtLp/3d02bpZJNtoi6GT27s6Yyc44M7v9oU9FUHwx6psUxL+3gCAo9Q/bPrQvlQol2tQgKD60+INQ6Ium65k7M5lpurHeZe58853vnnvuuWfvBei5qliWkRQBFpquLRcy4nOHj4g9K5CEh6AXBqFXUR0rXalMAjZPC3e1W99Dwntf2dXd/p+tt0YdFSBxH2Kz5qgLiI8B8KdVy3YBevqRHz/qWh72Yui3MUDEL3q44WPXw3M+fo1pZuQs4tOIBVVTaoiXEI/MxfhGDPsxsNZfoE1q66ro5aJim3XdoLFw72H+n23BaIXzbcOnz5mfPoTvYVz7KzUl5+FRxEuqkp9G/Ajia219thzg25abkRE/BpDc3pqvphHvRFys2weqvp+krbWKIX7nhDbzLOItiM8358pTwdirqpPFnMF2xLc1WvLyOwTAibpbmvHHcvttU57y5+XqNZrLe3lE/Pq8eUj2fXKfOe3pfOjzhJYtB/yll5SDFcSDiH+hRkH25+L+sdxKEAMZahrlSX8ukqMOWy/jXW2m6M9LDBc31B9LFuv6gVKg/0Szi3KAr1kGq1GMjU/aLbnq6/lRxc4XfJ98hTargX++DbMJBSiYMIe9Ck1YAxFkKEAG3xbYaKmDDgYyFK0UGYpf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QAREQAREQAREQAREQAREQAREQAREoFEISAHUKHdS5RABERABERABERABERABERABERABERCBLASkAMoCRptFQAREQAREQAREQAREQAREQAREQAREoFEISAHUKHdS5RABERABERABERABERABERABERABERCBLASkAMoCRptFQAREQAREQAREQAREQAREQAREQAREoFEISAHUKHdS5RABERABERABERABERABERABERABERCBLASkAMoCRptFQAREQAREQAREQAREQAREQAREQAREoFEISAHUKHdS5RABERABERABERABERABERABERABERCBLARaZdmuzVMJTJkyxU2ePNm99957bs4553TzzTefW2ihhcRGBEQgYQLff/+9e+2119yvv/7q69nCCy/s2rRpk/BVdDoREAEREAEREAEREAEIqO2l50AEmpOAFECR+/7222+7yy67zL388stu4sSJ7rvvvmuRYpFFFnEbbbSR6927t1t00UVb7Gv0f6644go3YsQIX8yhQ4e6rl27FlXkd9991/Xs2dMfgyLttttuK+r4Zkn8+++/u08//XQaZeOtt97qhg0b5jEcdthhGZb1yIUyXnfdde6RRx5xr776quPZCKV169ZujTXWcN27d3fbbLONm3765jJWLLWuoUDbcMMN3c8//+xx3nHHHW7++ecP0U6z/uijj7oDDzwws33zzTd3Rx99dOb/bCs77bSTe/311/3u0aNHuxVWWMHdfvvtjncDcsghh7gdd9zRrxf756GHHnL9+/f3h+27776uV69esad4//333d/+9rdp9tV7XeH+rbvuutOUK7phxhlndDPNNJNbYIEFXMeOHV2PHj3ckksuGU1Wsf+z8U/qgqXWA7u+vjlGIvcy231UPcrNLam92fgndf5S61GjfE/sWzXDDDO4CRMmZMWa7T7Uez0IC6y2V0jjr/Wk2i5/nVFrIpBuAlIABffn7LPP9gqO3377LdjacvWDDz5wl19+ubv22mvdQQcd5OicNIv8+OOP7vPPP/fFtQ5mMWXnw2PH02mRTEvgySefdIMHD3Y77LCD22233Vok+OmnnzL8uBf1KljU9enTx1v8ZCsDDc/x48f736WXXuqom+3bt8+WvOG2l1rXUJwttthinhtQnnrqqbyK2gceeCDzXHEMSqN8CqBvv/3WPfbYY95KcvbZZ3fLLLMMh3rFk9Xxcp5R3i92nh9++MGfO/zDtrPOOsvdeOON7oknngh3+fVGqCtW/mkKF7PhnXfecY8//rg7//zzvSKI+oIVXaUkH/+krltqPbDr65tjJOKX+e6j6lFz16NG+Z589dVX/nuCAihOmqEeUG61veLu/h/bwjZHOW2X7FfQHhFIFwEpgP68HxdffLE79dRTM3dnwQUXdF26dHFt27Z1c889t/94MDpwzz33uG+++cb98ssv7qSTTnLTTTed22effTLHaUUESiVw7733esVIqcfXw3Fffvml22WXXXxDxPLbuXNnr0Cgzv3vf/9zH374oXv++ee98oI0L730kj+Gzn4+axY7ZzMv11lnnYwCCIViPks9rG1CwfoMq6xll1023NxiHcUSLrLI2muv7Vq1qu6nZLvttvNWmnPNNVeLfDXqP//4xz+mKRr8UXDQWKXO8E1Cnn32WbfXXnu5G264oWJulM3Gfxr4DbKh2e6j6lHxD66+J8UzS+MRanul8a4oTyJQOwLVbbXXrpw5r/zFF1+4k08+OZMG95o999zTYV4fFawzUPxgUotwHB2sZrJOiDLR/8kQ+O9//5s5EYrFRhQsFBiFQpZaailvsZDNZQXLjv3339999tlnPhbXiSee6E455ZRGxJJomWiwmzz99NO2GrvEovHNN9/0+zbZZBN39913+3WUQrkUQKHVzfrrr58591prreXOPfdc/3+u4zMHlLjy9ddf+yMbtZ5EseRzl2X08vjjj3dYyyGvvPKKO/LII1sMakTPWc7/zca/HFZpPrbZ7qPqUfFPo74nxTNL4xFqe+W+K9Vqu+TOhfaKQPUITF+9S6X3SjfffHMmZsa2227r3brilD+UAHcHYlxssMEGvkBYLGA9JBEBEchNAIuFq6++2iei4069yab8IRExgM4555xM/B/88LFOkeQmQCwegtYjxDLLZc788MMPZ0623377uVlmmcX//+CDD2a2
</div>
<script type="text/javascript">
window.onload = function() {
var i, fig = 1, caps = document.getElementsByClassName('caption');
for (i = 0; i < caps.length; i++) {
var cap = caps[i];
if (cap.parentElement.className !== 'figure' || cap.nodeName !== 'P')
continue;
cap.innerHTML = '<span>Figure ' + fig + ':</span> ' + cap.innerHTML;
fig++;
}
fig = 1;
caps = document.getElementsByTagName('caption');
for (i = 0; i < caps.length; i++) {
var cap = caps[i];
if (cap.parentElement.nodeName !== 'TABLE') continue;
cap.innerHTML = '<span>Table ' + fig + ':</span> ' + cap.innerHTML;
fig++;
}
}
</script>
<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
(function () {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
document.getElementsByTagName("head")[0].appendChild(script);
})();
</script>
</body>
</html>