title: How do i add a line to the bottom of a tableGrob?
body: <p>Say I have a table like this:</p>
  
  <pre><code>df1 &lt;- data.frame(x=1,y=1,z=1)
  </code></pre>
  
  <p>And I turn it into a tableGrob like this:</p>
  
  <pre><code>tableGrob(df1,rows = NULL) %&gt;% grid.draw()
  </code></pre>
  
  <p>How do I add a line to the bottom? </p>
  
  <p>I can add a line to the top like this:</p>
  
  <pre><code>tableGrob(df1,rows = NULL) %&gt;%   gtable_add_grob(
  grobs = segmentsGrob( # line across the bottom
    x0 = unit(0,"npc"),
    y0 = unit(1,"npc"),
    x1 = unit(2,"npc"),
    y1 = unit(1,"npc"),
    gp = gpar(lwd = 2)),
  t = 1, b = 1, l = 1, r = 3) %&gt;% grid.draw()
  </code></pre>
  
  <p>Or to the second line like this  (changed t=1 to t=2 and b=1 to b=2):</p>
  
  <pre><code>tableGrob(df1,rows = NULL) %&gt;%   gtable_add_grob(
  grobs = segmentsGrob( # line across the bottom
    x0 = unit(0,"npc"),
    y0 = unit(1,"npc"),
    x1 = unit(2,"npc"),
    y1 = unit(1,"npc"),
    gp = gpar(lwd = 2)),
  t = 2, b = 2, l = 1, r = 3) %&gt;% grid.draw()
  </code></pre>
  
  <p>But when I try this (t=3 and b=3):</p>
  
  <pre><code>tableGrob(df1,rows = NULL) %&gt;%   gtable_add_grob(
  grobs = segmentsGrob( # line across the bottom
    x0 = unit(0,"npc"),
    y0 = unit(1,"npc"),
    x1 = unit(2,"npc"),
    y1 = unit(1,"npc"),
    gp = gpar(lwd = 2)),
  t = 3, b = 3, l = 1, r = 3) %&gt;% grid.draw()
  </code></pre>
  
  <p>I get the following error:  </p>
  
  <pre><code>Error in grid.Call.graphics(C_setviewport, vp, TRUE) :   invalid 'layout.pos.row'
  </code></pre>
  
  <p>Also, this does not work (t=2 and b=2, but y0=2 and y1=2):  </p>
  
  <pre><code>tableGrob(df1,rows = NULL) %&gt;%   gtable_add_grob(
  grobs = segmentsGrob( # line across the bottom
    x0 = unit(0,"npc"),
    y0 = unit(2,"npc"),
    x1 = unit(2,"npc"),
    y1 = unit(2,"npc"),
    gp = gpar(lwd = 2)),
  t = 2, b = 2, l = 1, r = 3) %&gt;% grid.draw()
  </code></pre>
  
  <p>Any ideas?  Why specifically did the attempts to add a line at the bottom fail?</p>