title: Colorize/highlight values of R ftable() output in knitr/Sweave rapports
body: <p>I am generating a lot of <code>ftable()</code> crosstabulations for a descriptive report. Example:</p>
  
  <pre><code>              AUS  BEL  BUL  EST  FRA  GEO  GER  HUN  ITA  NET  NOR  ROM  RUS
  
  30- primary    0.06 0.03 0.07 0.03 0.02 0.03 0.03 0.02 0.05 0.03 0.05 0.04 0.02
      secondary  0.30 0.09 0.16 0.10 0.10 0.14 0.10 0.16 0.11 0.08 0.08 0.09 0.11 
      tertiary   0.05 0.07 0.04 0.05 0.07 0.06 0.02 0.04 0.02 0.05 0.06 0.02 0.09
  30+ primary    0.07 0.16 0.12 0.07 0.16 0.03 0.05 0.11 0.35 0.21 0.09 0.17 0.03
      secondary  0.40 0.20 0.30 0.29 0.25 0.35 0.35 0.34 0.27 0.20 0.27 0.34 0.26
      tertiary   0.13 0.23 0.13 0.18 0.17 0.17 0.18 0.09 0.09 0.23 0.23 0.06 0.24
  60+ primary    0.00 0.12 0.10 0.13 0.14 0.07 0.05 0.12 0.09 0.11 0.06 0.19 0.12
      secondary  0.00 0.05 0.05 0.08 0.06 0.10 0.14 0.09 0.02 0.04 0.11 0.07 0.06
      tertiary   0.00 0.05 0.03 0.06 0.03 0.04 0.07 0.03 0.01 0.05 0.06 0.02 0.07
  </code></pre>
  
  <p>I am looking for a function that could take the <code>ftable()</code> or <code>table()</code> output, and highligh values that deviate from the row-mean, or assign an overall gradient to the text of the values, e.g. from 0-100% the values are coloured from red to green.</p>
  
  <p>The output is now processed through <a href="http://yihui.name/knitr/" rel="nofollow">knitr</a>, but I'm not sure at which point in the toolchain I could intervene and add colour based on the relative size of the values.</p>