title: Is there a way to set significant digit display in a flextable?
body: <p>I am trying to set significant digit display for a <a href="/questions/tagged/flextable" class="post-tag" title="show questions tagged &#39;flextable&#39;" rel="tag">flextable</a> object.</p>
  
  <pre><code># Select data from a dataframe
  ft &lt;- flextable(data, col_keys = c(1,2,3,4)) 
  # adjust digit display in columns 3 and 4 of flextable
  ft &lt;- colformat_num(ft, j = c(3,4), digits = 4)
  </code></pre>
  
  <p>However, the digits argument in this snippet sets digits <strong>after</strong> the decimal point, as opposed to rounding a number to n significant digits. Here is a sample formula from Excel:</p>
  
  <blockquote>
    <p>=ROUND(number,digits-(1+INT(LOG10(ABS(number)))))</p>
  </blockquote>
  
  <p>Can this be reproduced in the <code>flextable</code> command? Thanks for helping!</p>