<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title> SampleStat - Articles</title>
    <description>Latest SampleStat news</description>
    <link>https://www.samplestat.org</link>
    
      
        <item>
          <title>Hide your password in R</title>
          <description>&lt;p&gt;
There is several way to hide password in R. I recommend you
&lt;a href=&quot;https://www.youtube.com/watch?v=8ZtInClXe1Q&quot;&gt;to see this video&lt;/a&gt;
if you want to have a more accurate picture on how to do
it using fully encrypted password. There is specific libraries available
in R which deal with encryption like &lt;a href=&quot;https://cran.r-project.org/web/packages/sodium/vignettes/intro.html&quot;&gt;sodium&lt;/a&gt; and also
&lt;a href=&quot;https://cran.r-project.org/web/packages/sodium/vignettes/crypto101.html&quot;&gt;using XOR operator and others&lt;/a&gt;. 
&lt;/p&gt;

</description>
          <pubDate>2017-12-20T10:51:12+01:00</pubDate>
          <link>https://www.samplestat.org/hide-your-password-in-r/</link>
          <guid isPermaLink="true">https://www.samplestat.org/hide-your-password-in-r/</guid>
        </item>
      
    
      
        <item>
          <title>Mean of the n last or first</title>
          <description>&lt;p&gt;
A small post today that could be very useful. A colleague ask me
how to compute the mean of the 5 oldest trees in a populations. The
following code that I have found in &lt;a href=&quot;https://stackoverflow.com/&quot;&gt;stackoverflow&lt;/a&gt;.
&lt;/p&gt;

</description>
          <pubDate>2017-06-01T02:00:00+02:00</pubDate>
          <link>https://www.samplestat.org/mean-of-the-n-last-or-first/</link>
          <guid isPermaLink="true">https://www.samplestat.org/mean-of-the-n-last-or-first/</guid>
        </item>
      
    
      
        <item>
          <title>parallelisation computing</title>
          <description>&lt;p&gt;
I already show you how to do &lt;code&gt;for&lt;/code&gt; loop and nested &lt;code&gt;for&lt;/code&gt; loop. When you
want to do parallelisation computing, you simply replace the &lt;code&gt;for&lt;/code&gt;
command by the &lt;code&gt;foreach&lt;/code&gt; command and &lt;code&gt;%dopart%&lt;/code&gt;.
&lt;/p&gt;

</description>
          <pubDate>2017-05-10T02:00:00+02:00</pubDate>
          <link>https://www.samplestat.org/parallelisation-computing/</link>
          <guid isPermaLink="true">https://www.samplestat.org/parallelisation-computing/</guid>
        </item>
      
    
      
        <item>
          <title>&lt;code&gt;.emacs&lt;/code&gt; in org mode</title>
          <description>&lt;p&gt;
Usually, when you are using Emacs, all your favourite shortcut and
others Emacs characteristic are in the &lt;code&gt;.emacs&lt;/code&gt; file. However, to have a
better &lt;code&gt;.emacs&lt;/code&gt; organisation, I suggest you to use the org-mode with
your &lt;code&gt;.emacs&lt;/code&gt;. Like this, you can organise very easily your &lt;code&gt;.emacs&lt;/code&gt; and
put categories 
&lt;/p&gt;

</description>
          <pubDate>2017-04-26T02:00:00+02:00</pubDate>
          <link>https://www.samplestat.org/emacs-in-org-mode-emacs/</link>
          <guid isPermaLink="true">https://www.samplestat.org/emacs-in-org-mode-emacs/</guid>
        </item>
      
    
      
        <item>
          <title>Nested &lt;code&gt;for&lt;/code&gt; loop</title>
          <description>&lt;p&gt;
I already talk about single &lt;code&gt;for&lt;/code&gt; loop in a &lt;a href=&quot;/for-loop/&quot;&gt;previous post&lt;/a&gt;. The same way
we did &lt;code&gt;for&lt;/code&gt; loop for a single object, we can do it multiple times.
&lt;/p&gt;

</description>
          <pubDate>2017-03-24T01:00:00+01:00</pubDate>
          <link>https://www.samplestat.org/nested-for-loop/</link>
          <guid isPermaLink="true">https://www.samplestat.org/nested-for-loop/</guid>
        </item>
      
    
      
        <item>
          <title>data.table</title>
          <description>&lt;p&gt;
When you are doing a lot of R, you can find two different kind of
people, the &lt;a href=&quot;https://cran.r-project.org/web/packages/dplyr/index.html&quot;&gt;dplyr&lt;/a&gt; and the &lt;a href=&quot;https://github.com/Rdatatable/data.table/wiki&quot;&gt;data.table&lt;/a&gt; people. Indeed, those to packages
are used for table manipulation. They are like the &lt;a href=&quot;http://ggplot2.org/&quot;&gt;ggplot2&lt;/a&gt; function
 for graphic, when you know them  they change
your R experience and you cannot go back. 
&lt;/p&gt;

</description>
          <pubDate>2017-03-08T01:00:00+01:00</pubDate>
          <link>https://www.samplestat.org/data-table-data-table/</link>
          <guid isPermaLink="true">https://www.samplestat.org/data-table-data-table/</guid>
        </item>
      
    
      
        <item>
          <title>Workflow</title>
          <description>&lt;p&gt;
How you organise yourself when doing R will make it easier for you if
you need to go back to your script weeks or years after, and to share
with others people.
&lt;/p&gt;

</description>
          <pubDate>2017-02-14T01:00:00+01:00</pubDate>
          <link>https://www.samplestat.org/workflow/</link>
          <guid isPermaLink="true">https://www.samplestat.org/workflow/</guid>
        </item>
      
    
      
        <item>
          <title>Creating a function</title>
          <description>&lt;p&gt;
In R, most of people used build-in functions which are very useful
for all basics statistical analyses. When you need to do more complex
statistics you can use packages.
There is almost every current statistical functions and more in the
&lt;a href=&quot;https://cran.r-project.org/&quot;&gt;CRAN repository&lt;/a&gt;. However, time to time you will need to build your own function. Usually, when I build a function is because &lt;code&gt;for&lt;/code&gt; loop will not be efficient and that I need to put different parameters that I can change.
I will take here an easy example that I have previously done for my work.
I wanted to build a short function to draw maps and save them if I needed to.
&lt;/p&gt;

</description>
          <pubDate>2017-01-22T01:00:00+01:00</pubDate>
          <link>https://www.samplestat.org/creating-a-function/</link>
          <guid isPermaLink="true">https://www.samplestat.org/creating-a-function/</guid>
        </item>
      
    
      
        <item>
          <title>For loop</title>
          <description>&lt;p&gt;
Using loop with R is not the proper behaviour to have. Indeed,
using the apply functions family such as &lt;i&gt;tapply&lt;/i&gt;, &lt;i&gt;lapply&lt;/i&gt;, and so
one are a better way to do it, but for me, this is in some case too
complicated.
The apply family functions improve the speed rate of T and the management of the memory. Thus,  apply functions is relevant to use when you have big data-set to play with.
Instead of using apply functions, I used &lt;code&gt;for&lt;/code&gt; loop. This is simpler to understand it  for me and with moderate data-set (about few thousand of rows and 100 columns) the gain of apply functions is limited.
Like this, &lt;code&gt;for&lt;/code&gt; loop can be read again quickly even when you comeback to your code years later.
I will now provide a small example to understand when you can use &lt;code&gt;for&lt;/code&gt; loop and how to used them.  Also, note that understanding &lt;code&gt;for&lt;/code&gt; loop will lead to use &lt;code&gt;foreach&lt;/code&gt; function which allow parallelisation computing. It will be explain in another post.
&lt;/p&gt;

</description>
          <pubDate>2017-01-20T15:31:14+01:00</pubDate>
          <link>https://www.samplestat.org/for-loop/</link>
          <guid isPermaLink="true">https://www.samplestat.org/for-loop/</guid>
        </item>
      
    
      
        <item>
          <title>Convert factor to character</title>
          <description>&lt;p&gt;
In R, you used sometimes functions to convert vectors to another
format with &lt;code&gt;as.character&lt;/code&gt;, &lt;code&gt;as.factor&lt;/code&gt; or &lt;code&gt;as.numeric&lt;/code&gt;. 
&lt;/p&gt;

</description>
          <pubDate>2017-01-12T01:00:00+01:00</pubDate>
          <link>https://www.samplestat.org/convert-factor-to-character/</link>
          <guid isPermaLink="true">https://www.samplestat.org/convert-factor-to-character/</guid>
        </item>
      
    
      
        <item>
          <title>Emacs + ESS = loving R</title>
          <description>&lt;p&gt;
Since my second year of university I have studied Statistic with R on Windows using
the basic text editor from the R GUI console. I was happy with it for a
couple of years. However, when I start coding more complex and longer
function, it was a nightmare to handle human issues, specially
parentheses tracking. A professor told me that they were some programs
specific to code in R, such as &lt;a href=&quot;http://nbcgib.uesc.br/lec/software/editores/tinn-r/en&quot;&gt;Tinn-R&lt;/a&gt; or the well known &lt;a href=&quot;https://www.rstudio.com/&quot;&gt;R-Studio&lt;/a&gt;. I
also found that Notepad++ as a plugin (&lt;a href=&quot;https://sourceforge.net/projects/npptor/&quot;&gt;nppToR&lt;/a&gt;) to link the text
editor to R. However, after trying R-Studio and Notepad++, I was not
very happy with them. I always did not like the multi-windows
design from R-Studio, and Notepad++ was only a better way to use
the script function from the R GUI. It was not fully integrated
R. Finally, my professor told me about Emacs, and how it was working
with R. I first try it with Windows, using the very good
&lt;a href=&quot;http://vgoulet.act.ulaval.ca/en/emacs/&quot;&gt;Emacs version from Vincent Goulet&lt;/a&gt;. It was exactly what I was looking for. A software
that can interact with R without a lot of windows, and well integrated
with R. Few years later, I jump to Linux using first Manjaro (an
ArchLinux distribution), and after Xubuntu to keep the very good XFCE
desktop environment. 
&lt;/p&gt;

</description>
          <pubDate>2016-12-30T01:00:00+01:00</pubDate>
          <link>https://www.samplestat.org/emacs-ess-loving-r/</link>
          <guid isPermaLink="true">https://www.samplestat.org/emacs-ess-loving-r/</guid>
        </item>
      
    
  </channel>
</rss>
