<p>I like to use the <code>reprex</code> package. If you do <code>reprex::reprex(venue=&quot;so&quot;)</code> it produces a stackoverflow-friendly formatted text out of whatever R code you have on the clipboard right now:</p>

<pre><code>lm(rnorm(10) ~ I(rnorm(10)))
#&gt; 
#&gt; Call:
#&gt; lm(formula = rnorm(10) ~ I(rnorm(10)))
#&gt; 
#&gt; Coefficients:
#&gt;  (Intercept)  I(rnorm(10))  
#&gt;     -0.13374      -0.09452
</code></pre>
<p><sup>Created on 2020-10-09 by the <a href="https://reprex.tidyverse.org" rel="nofollow noreferrer">reprex package</a> (v0.3.0)</sup></p>
<p>As you see, the output is included as R comments so it will not interfere with copy/paste. As a bonus it automatically renders whatever plots are in there and uploads to imgur, inserts the right link.</p>
