title: grid.table() conditional formatting in R
body: <hr>
  
  <p>I was looking at this <a href="http://code.google.com/p/gridextra/wiki/tableGrob" rel="nofollow">link</a>, that produces a grid table and does text formatting. Is there any way I can do conditional formatting?
  For e.g. </p>
  
  <ol>
  <li>Set background color based on the value</li>
  <li>Show negative values as red and blue otherwise</li>
  </ol>
  
  <hr>
  
  <pre><code>source("http://gridextra.googlecode.com/svn/trunk/inst/tableGrob2.r")
  library(grid)
  
  tc  = textConnection("
   carat   VeryLongWordIndeed color clarity depth
  14513  1.35 Ideal     J     VS2  61.4
  28685  0.30  Good     G    VVS1  64.0
  50368  0.75 Ideal     F     SI2  59.2")
  d = read.table(tc,head=T)
  close(tc)
  grid.newpage()
  g = grid.table2(d)
  grid.gedit(paste("cells-fill-",1,2,sep=""), gp=gpar(fill="red"))
  </code></pre>
  
  <p>This works as expected. But if you have more than 10 rows, it doesn't. It colors more than one cell. For e.g.</p>
  
  <pre><code>d&lt;-do.call("rbind", replicate(10, d, simplify = FALSE))
  grid.newpage()
  g = grid.table2(d)
  grid.gedit(paste("cells-fill-",1,2,sep=""), gp=gpar(fill="red"))
  </code></pre>
  
  <p>How to avoid this?</p>