title: Rounding only numeric variables with ifelse
body: <p>I have a very large dataframe (around 100 rows, 200 columns). A subset of my data looks like this:</p>
  <pre><code>example &lt;- data.frame(&quot;Station&quot; = c(&quot;012&quot;, &quot;013&quot;, &quot;014&quot;), &quot;Value1&quot; = c(145.23453, 1.022342, 0.4432), 
  &quot;Value2&quot; = c(2.1221213, 4445.2231412, 0.3333421), &quot;Name&quot; = c(&quot;ABC&quot;, &quot;SDS&quot;, &quot;EFG&quot;))
  </code></pre>
  <p>I would like to round all numeric variables in my table with these conditions.</p>
  <p>if x&lt;1, then 1 sig fig</p>
  <p>if  1&lt;= x &lt; 99, then 2 sig figs</p>
  <p>if x&gt;= 100, then 3 sig figs</p>
  <p>I know to do something like this for a specific column:</p>
  <pre><code>example$Value1 &lt;- ifelse(example$Value1 &lt; 1, signif(example$Value1, 1), example$Value1)
  </code></pre>
  <p>but I'm not sure what to do for a large dataframe with a mix of numeric and character values.</p>