<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mauro Loprete</title>
    <description>The latest articles on DEV Community by Mauro Loprete (@mauroloprete).</description>
    <link>https://dev.to/mauroloprete</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F553601%2F60ea065b-559b-45c0-8447-ab06cb8161f0.jpeg</url>
      <title>DEV Community: Mauro Loprete</title>
      <link>https://dev.to/mauroloprete</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mauroloprete"/>
    <language>en</language>
    <item>
      <title>Reproducible R code with PACMAN</title>
      <dc:creator>Mauro Loprete</dc:creator>
      <pubDate>Tue, 12 Jan 2021 00:13:45 +0000</pubDate>
      <link>https://dev.to/mauroloprete/reproducible-code-with-pacman-36hm</link>
      <guid>https://dev.to/mauroloprete/reproducible-code-with-pacman-36hm</guid>
      <description>&lt;p&gt;Maybe you ever found yourself in the situation of having to share an R script and having to give too many explanations 😂 😂! &lt;br&gt;
In R, the use of libraries is very frequent and these are installed locally on each computer, so a good way to make our codes reproducible is to use &lt;em&gt;Pacman&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;This library that is available in CRAN has a very useful function &lt;strong&gt;p_load()&lt;/strong&gt;. This function loads the package to the work area and, if it is not installed, installs it. &lt;/p&gt;

&lt;p&gt;Well ... yes, but in this case I should warn you to install pacman to run my code&lt;/p&gt;
&lt;h3&gt;
  
  
  NO !
&lt;/h3&gt;

&lt;p&gt;With this simple sentence, we can do that in the case that the person does not have pacman installed, install it. &lt;em&gt;And for the other libraries use p_load()&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  An example :
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"pacman"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="n"&gt;install.packages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"pacman"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="n"&gt;library&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pacman&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;p_load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;here&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;pracma&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;tidyverse&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;magrittr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;In this case, we call the library pracma, tidyverse and here.&lt;/p&gt;

&lt;p&gt;Another library that focuses on reproducibility is "here", this library uses the workspace we are working on and concatenates its arguments separated by commas.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="n"&gt;here&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"ExampleHere"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;"Folder1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;"Script1.R"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And the result :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QsqmHwVj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/xlcvolc9x990brogja7b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QsqmHwVj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/xlcvolc9x990brogja7b.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Share your code!
&lt;/h3&gt;

</description>
      <category>rprogramming</category>
      <category>datascience</category>
      <category>pacman</category>
      <category>sharecode</category>
    </item>
    <item>
      <title>Magrittr R in VScode</title>
      <dc:creator>Mauro Loprete</dc:creator>
      <pubDate>Mon, 11 Jan 2021 22:42:57 +0000</pubDate>
      <link>https://dev.to/mauroloprete/magrittr-r-in-vscode-5g9a</link>
      <guid>https://dev.to/mauroloprete/magrittr-r-in-vscode-5g9a</guid>
      <description>&lt;h1&gt;
  
  
  Hi!
&lt;/h1&gt;

&lt;p&gt;Using Magrittr in your R script is very useful. If you use them frequently and your IDE is Vscode, you're in luck!&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pX-RnC16--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/lggzei7pdupdzvvqn5nu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pX-RnC16--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/lggzei7pdupdzvvqn5nu.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step by step :
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Execute the following key combination
"Ctrl + K Ctrl + S"&lt;/li&gt;
&lt;li&gt;In the upper right corner enter "Open Keyboards Shortcuts (JSON)"&lt;/li&gt;
&lt;li&gt;Copy the code&lt;/li&gt;
&lt;li&gt;Done!&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Link:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://gitlab.com/-/snippets/2059588"&gt;https://gitlab.com/-/snippets/2059588&lt;/a&gt;&lt;/p&gt;

</description>
      <category>rprogramming</category>
      <category>vscode</category>
      <category>keybindings</category>
      <category>magrittr</category>
    </item>
    <item>
      <title>Snippets RMarkdown templates in VScode</title>
      <dc:creator>Mauro Loprete</dc:creator>
      <pubDate>Mon, 11 Jan 2021 22:23:42 +0000</pubDate>
      <link>https://dev.to/mauroloprete/snippets-rmarkdown-in-vscode-5gk0</link>
      <guid>https://dev.to/mauroloprete/snippets-rmarkdown-in-vscode-5gk0</guid>
      <description>&lt;p&gt;Hello!&lt;br&gt;
I use R in VScode and using Snippets for my R Markdwon templates makes my time really fast. This is why I decided to share them with you.&lt;br&gt;
&lt;a href="https://gitlab.com/-/snippets/2059664"&gt;https://gitlab.com/-/snippets/2059664&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eGiSYrW8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/sz54trt083pa22hk4kga.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eGiSYrW8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/sz54trt083pa22hk4kga.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>snippets</category>
      <category>rprogramming</category>
      <category>vscode</category>
      <category>latex</category>
    </item>
    <item>
      <title>Hi! </title>
      <dc:creator>Mauro Loprete</dc:creator>
      <pubDate>Tue, 05 Jan 2021 00:21:27 +0000</pubDate>
      <link>https://dev.to/mauroloprete/hi-e42</link>
      <guid>https://dev.to/mauroloprete/hi-e42</guid>
      <description>

</description>
    </item>
  </channel>
</rss>
