<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/carbonate/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://yonicd.netlify.com/post/carbonate/"> Rstats on Reproducible Random Thoughts</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p><a rel="nofollow" href="https://carbon.now.sh/about" target="_blank">carbon.js</a> is the easiest way to create beautiful images of your source code, and <a rel="nofollow" href="https://yonicd.github.io/carbonate/" target="_blank">carbonate</a> creates an api in <code>R</code> to interact with it. The package gives a new simple way to share your script with the rest of the <code>R</code> community on posters, slides, Shiny apps and social media!</p>
<blockquote class="twitter-tweet" data-lang="en">
<p lang="en" dir="ltr">
This little snippet combines SO MANY of my favorite <a rel="nofollow" href="https://twitter.com/hashtag/rstats?src=hash&ref_src=twsrc%5Etfw" target="_blank">#rstats</a> <img alt="📦" src="https://s.w.org/images/core/emoji/2.4/72x72/1f4e6.png" class="wp-smiley">s:<br><img alt="✨" src="https://s.w.org/images/core/emoji/2.4/72x72/2728.png" class="wp-smiley"> <a rel="nofollow" href="https://twitter.com/jimhester_?ref_src=twsrc%5Etfw" target="_blank"><span>@jimhester_</span></a>‘s glue<br><img alt="🥛" src="https://s.w.org/images/core/emoji/2.4/72x72/1f95b.png" class="wp-smiley"> <a rel="nofollow" href="https://twitter.com/yoniceedee?ref_src=twsrc%5Etfw" target="_blank"><span>@yoniceedee</span></a>‘s carbonate<br><img alt="🐦" src="https://s.w.org/images/core/emoji/2.4/72x72/1f426.png" class="wp-smiley"> <a rel="nofollow" href="https://twitter.com/kearneymw?ref_src=twsrc%5Etfw" target="_blank"><span>@kearneymw</span></a>‘s rtweet<br><img alt="😎" src="https://s.w.org/images/core/emoji/2.4/72x72/1f60e.png" class="wp-smiley"> <a rel="nofollow" href="https://twitter.com/hadleywickham?ref_src=twsrc%5Etfw" target="_blank"><span>@hadleywickham</span></a>‘s emo<br><img alt="📍" src="https://s.w.org/images/core/emoji/2.4/72x72/1f4cd.png" class="wp-smiley"> <a rel="nofollow" href="https://twitter.com/krlmlr?ref_src=twsrc%5Etfw" target="_blank"><span>@krlmlr</span></a>‘s here <a rel="nofollow" href="https://t.co/ploHThYu82" target="_blank">https://t.co/ploHThYu82</a>
</p>
<p>— 𝓛𝓾𝓬𝔂::maternity_leave<img alt="🤱" src="https://s.w.org/images/core/emoji/2.4/72x72/1f931.png" class="wp-smiley"> (<span>@LucyStats</span>) <a rel="nofollow" href="https://twitter.com/LucyStats/status/1034972003130851328?ref_src=twsrc%5Etfw" target="_blank">August 30, 2018</a>
</p></blockquote>
<p></p>
<div>
<h2>Installation</h2>
<pre><code>#remotes::install_github('yonicd/carbonate')
install.packages('carbonate')</code></pre>
</div>
<div>
<h2>Usage</h2>
<div>
<h3>Initialize new carbon object</h3>
<pre><code>library(carbonate)</code></pre>
<p>The default code in the carbon object is taken from the clipboard.</p>
<pre><code>x &lt;- carbon$new()</code></pre>
<p>But can also be defined inline. Code can be a character object of any length.</p>
<pre><code>x &lt;- carbon$new(readLines('DESCRIPTION'))</code></pre>
<p>The code is kept in the object and can be changed at any time.</p>
<pre><code>x$code</code></pre>
<pre><code>##  [1] &quot;Package: carbonate&quot;                                                                                 
##  [2] &quot;Title: Interact with 'carbon.js'&quot;                                                                   
##  [3] &quot;Version: 0.1.0&quot;                                                                                     
##  [4] &quot;Authors@R: person(given  = \&quot;Jonathan\&quot;,&quot;                                                           
##  [5] &quot;                 family  = \&quot;Sidi\&quot;,&quot;                                                               
##  [6] &quot;                 email   = \&quot;yonicd@gmail.com\&quot;,&quot;                                                   
##  [7] &quot;                 role    = c(\&quot;aut\&quot;, \&quot;cre\&quot;),&quot;                                                    
##  [8] &quot;                 comment = c(ORCID = \&quot;0000-0002-4222-1819\&quot;))&quot;                                     
##  [9] &quot;Description: Create beautiful images of source code using 'carbon.js'</code></pre></div></div>