title: Specific number of decimals depending on size of number
body: <p>I'm trying to show &quot;significant digits&quot; of my data set. I have a dataset with both high and low numbers that I want to present in a data table (by data table here, I mean, a figure in a paper, not a data table (DT) in R). I do not want to settle on a fixed number of decimals. I want numbers &gt;10 = 0 decimals, numbers between 10 to &gt;0 = 1 decimal, 0 to 0.1 = 2 decimals, 0.1 to &gt;0.01 =3 decimals, &lt;0.01 = 4 decimals</p>
  <p>I've tried to use functions from a package that does something similar, but that has not worked out for me.
  This is what I've tried</p>
  <pre><code>options(pillar.sigfig = 1)
  df &lt;- as_tibble(df)
  </code></pre>
  <p>And here's the data</p>
  <pre><code>df &lt;- structure(list(i.x33.031 = c(13.6221, 0, 104.5006, 28.952, 26.0536, 
  4.1116, 62.0904, 136.6475, 0, 292.2651, 6.4563, 94.7135, 34.7291, 
  17.8716, 28.9009, 52.2754, 20.5167, 34.3839, 33.5275, 14.7052, 
  141.8956, 30.9969, 23.1827, 28.1245, 1.5097, 36.9295, 26.0542, 
  29.4029, 152.541, 1.6365), i.x35.034 = c(0.1233, 0, 0.0351, 0.0407, 
  0.0497, 0.0153, 0.0856, 0.2297, 0, 0.3863, 0.0032, 0.1962, 0.0873, 
  0.0362, 0.0378, 0.1137, 0.0459, 0.0715, 6e-04, 0.0318, 0.3318, 
  0.0005, 0.0643, 0.0588, 0.0008, 0.0588, 0.0627, 0.0789, 0.3215, 
  0.0215), days_incubated = c(4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 
  4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4)), row.names = c(NA, 
  -30L), class = c(&quot;tbl_df&quot;, &quot;tbl&quot;, &quot;data.frame&quot;))
  </code></pre>