Forcing R output to be scientific notation with at most two decimals
<p>I would like to have consistent output for a particular R script. In this case, I would like all numeric output to be in scientific notation with exactly two decimal places.</p>

<p>Examples:</p>

<pre><code>0.05 --&gt; 5.00e-02
0.05671 --&gt; 5.67e-02
0.000000027 --&gt; 2.70e-08
</code></pre>

<p>I tried using the following options:</p>

<pre><code>options(scipen = 1)
options(digits = 2)
</code></pre>

<p>This gave me the results:</p>

<pre><code>0.05 --&gt; 0.05
0.05671 --&gt; 0.057
0.000000027 --&gt; 2.7e-08
</code></pre>

<p>I obtained the same results when I tried:</p>

<pre><code>options(scipen = 0)
options(digits = 2)
</code></pre>

<p>Thank you for any advice.</p>