<p>What are EUCAST rules? The European Committee on Antimicrobial Susceptibility Testing (EUCAST) states <ahref="https://www.eucast.org/expert_rules_and_intrinsic_resistance/"class="external-link">on their website</a>:</p>
<p>What are EUCAST rules? The European Committee on Antimicrobial
Susceptibility Testing (EUCAST) states <ahref="https://www.eucast.org/expert_rules_and_intrinsic_resistance/"class="external-link">on
their website</a>:</p>
<blockquote>
<p><em>EUCAST expert rules are a tabulated collection of expert knowledge on intrinsic resistances, exceptional resistance phenotypes and interpretive rules that may be applied to antimicrobial susceptibility testing in order to reduce errors and make appropriate recommendations for reporting particular resistances.</em></p>
<p><em>EUCAST expert rules are a tabulated collection of expert
knowledge on intrinsic resistances, exceptional resistance phenotypes
and interpretive rules that may be applied to antimicrobial
susceptibility testing in order to reduce errors and make appropriate
recommendations for reporting particular resistances.</em></p>
</blockquote>
<p>In Europe, a lot of medical microbiological laboratories already apply these rules (<ahref="https://www.eurosurveillance.org/content/10.2807/1560-7917.ES2015.20.2.21008"class="external-link">Brown <em>et al.</em>, 2015</a>). Our package features their latest insights on intrinsic resistance and unusual phenotypes (v3.3, 2021).</p>
<p>Moreover, the <code><ahref="../reference/eucast_rules.html">eucast_rules()</a></code> function we use for this purpose can also apply additional rules, like forcing <helptitle="ATC: J01CA01">ampicillin</help> = R in isolates when <helptitle="ATC: J01CR02">amoxicillin/clavulanic acid</help> = R.</p>
<p>In Europe, a lot of medical microbiological laboratories already
apply these rules (<ahref="https://www.eurosurveillance.org/content/10.2807/1560-7917.ES2015.20.2.21008"class="external-link">Brown
<em>et al.</em>, 2015</a>). Our package features their latest insights
on intrinsic resistance and unusual phenotypes (v3.3, 2021).</p>
<p>Moreover, the <code><ahref="../reference/eucast_rules.html">eucast_rules()</a></code> function we use for this
purpose can also apply additional rules, like forcing
<helptitle="ATC: J01CA01">ampicillin</help> = R in isolates when
<p>These rules can be used to discard impossible bug-drug combinations in your data. For example, <em>Klebsiella</em> produces beta-lactamase that prevents ampicillin (or amoxicillin) from working against it. In other words, practically every strain of <em>Klebsiella</em> is resistant to ampicillin.</p>
<p>Sometimes, laboratory data can still contain such strains with ampicillin being susceptible to ampicillin. This could be because an antibiogram is available before an identification is available, and the antibiogram is then not re-interpreted based on the identification (namely, <em>Klebsiella</em>). EUCAST expert rules solve this, that can be applied using <code><ahref="../reference/eucast_rules.html">eucast_rules()</a></code>:</p>
<p>These rules can be used to discard impossible bug-drug combinations
in your data. For example, <em>Klebsiella</em> produces beta-lactamase
that prevents ampicillin (or amoxicillin) from working against it. In
other words, practically every strain of <em>Klebsiella</em> is
resistant to ampicillin.</p>
<p>Sometimes, laboratory data can still contain such strains with
ampicillin being susceptible to ampicillin. This could be because an
antibiogram is available before an identification is available, and the
antibiogram is then not re-interpreted based on the identification
(namely, <em>Klebsiella</em>). EUCAST expert rules solve this, that can
be applied using <code><ahref="../reference/eucast_rules.html">eucast_rules()</a></code>:</p>
<p>A more convenient function is <code><ahref="../reference/mo_property.html">mo_is_intrinsic_resistant()</a></code> that uses the same guideline, but allows to check for one or more specific microorganisms or antibiotics:</p>
<p>A more convenient function is
<code><ahref="../reference/mo_property.html">mo_is_intrinsic_resistant()</a></code> that uses the same guideline,
but allows to check for one or more specific microorganisms or
<p>EUCAST rules can not only be used for correction, they can also be used for filling in known resistance and susceptibility based on results of other antimicrobials drugs. This process is called <em>interpretive reading</em>, is basically a form of imputation, and is part of the <code><ahref="../reference/eucast_rules.html">eucast_rules()</a></code> function as well:</p>
<p>EUCAST rules can not only be used for correction, they can also be
used for filling in known resistance and susceptibility based on results
of other antimicrobials drugs. This process is called <em>interpretive
reading</em>, is basically a form of imputation, and is part of the
<code><ahref="../reference/eucast_rules.html">eucast_rules()</a></code> function as well:</p>
<p>With the function <code><ahref="../reference/mdro.html">mdro()</a></code>, you can determine which micro-organisms are multi-drug resistant organisms (MDRO).</p>
<p>With the function <code><ahref="../reference/mdro.html">mdro()</a></code>, you can determine which
micro-organisms are multi-drug resistant organisms (MDRO).</p>
<divclass="section level3">
<h3id="type-of-input">Type of input<aclass="anchor"aria-label="anchor"href="#type-of-input"></a>
</h3>
<p>The <code><ahref="../reference/mdro.html">mdro()</a></code> function takes a data set as input, such as a regular <code>data.frame</code>. It tries to automatically determine the right columns for info about your isolates, such as the name of the species and all columns with results of antimicrobial agents. See the help page for more info about how to set the right settings for your data with the command <code><ahref="../reference/mdro.html">?mdro</a></code>.</p>
<p>For WHONET data (and most other data), all settings are automatically set correctly.</p>
<p>The <code><ahref="../reference/mdro.html">mdro()</a></code> function takes a data set as input, such as a
regular <code>data.frame</code>. It tries to automatically determine the
right columns for info about your isolates, such as the name of the
species and all columns with results of antimicrobial agents. See the
help page for more info about how to set the right settings for your
data with the command <code><ahref="../reference/mdro.html">?mdro</a></code>.</p>
<p>For WHONET data (and most other data), all settings are automatically
<p>The <code><ahref="../reference/mdro.html">mdro()</a></code> function support multiple guidelines. You can select a guideline with the <code>guideline</code> parameter. Currently supported guidelines are (case-insensitive):</p>
<p>The <code><ahref="../reference/mdro.html">mdro()</a></code> function support multiple guidelines. You can
select a guideline with the <code>guideline</code> parameter. Currently
<p>Magiorakos AP, Srinivasan A <em>et al.</em> “Multidrug-resistant, extensively drug-resistant and pandrug-resistant bacteria: an international expert proposal for interim standard definitions for acquired resistance.” Clinical Microbiology and Infection (2012) (<ahref="https://www.clinicalmicrobiologyandinfection.com/article/S1198-743X(14)61632-3/fulltext"class="external-link">link</a>)</p>
<p>Magiorakos AP, Srinivasan A <em>et al.</em> “Multidrug-resistant,
extensively drug-resistant and pandrug-resistant bacteria: an
international expert proposal for interim standard definitions for
acquired resistance.” Clinical Microbiology and Infection (2012) (<ahref="https://www.clinicalmicrobiologyandinfection.com/article/S1198-743X(14)61632-3/fulltext"class="external-link">link</a>)</p>
<p>The European international guideline - EUCAST Expert Rules Version 3.2 “Intrinsic Resistance and Unusual Phenotypes” (<ahref="https://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/2020/Intrinsic_Resistance_and_Unusual_Phenotypes_Tables_v3.2_20200225.pdf"class="external-link">link</a>)</p>
<p>The European international guideline - EUCAST Expert Rules Version
3.2 “Intrinsic Resistance and Unusual Phenotypes” (<ahref="https://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/2020/Intrinsic_Resistance_and_Unusual_Phenotypes_Tables_v3.2_20200225.pdf"class="external-link">link</a>)</p>
</li>
<li>
<p><code>guideline = "EUCAST3.1"</code></p>
<p>The European international guideline - EUCAST Expert Rules Version 3.1 “Intrinsic Resistance and Exceptional Phenotypes Tables” (<ahref="https://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf"class="external-link">link</a>)</p>
<p>The European international guideline - EUCAST Expert Rules Version
3.1 “Intrinsic Resistance and Exceptional Phenotypes Tables” (<ahref="https://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf"class="external-link">link</a>)</p>
</li>
<li>
<p><code>guideline = "TB"</code></p>
<p>The international guideline for multi-drug resistant tuberculosis - World Health Organization “Companion handbook to the WHO guidelines for the programmatic management of drug-resistant tuberculosis” (<ahref="https://www.who.int/tb/publications/pmdt_companionhandbook/en/"class="external-link">link</a>)</p>
<p>The international guideline for multi-drug resistant tuberculosis -
World Health Organization “Companion handbook to the WHO guidelines for
the programmatic management of drug-resistant tuberculosis” (<ahref="https://www.who.int/tb/publications/pmdt_companionhandbook/en/"class="external-link">link</a>)</p>
</li>
<li>
<p><code>guideline = "MRGN"</code></p>
<p>The German national guideline - Mueller <em>et al.</em> (2015) Antimicrobial Resistance and Infection Control 4:7. DOI: 10.1186/s13756-015-0047-6</p>
<p>The German national guideline - Mueller <em>et al.</em> (2015)
Antimicrobial Resistance and Infection Control 4:7. DOI:
10.1186/s13756-015-0047-6</p>
</li>
<li>
<p><code>guideline = "BRMO"</code></p>
<p>The Dutch national guideline - Rijksinstituut voor Volksgezondheid en Milieu “WIP-richtlijn BRMO (Bijzonder Resistente Micro-Organismen) (ZKH)” (<ahref="https://www.rivm.nl/wip-richtlijn-brmo-bijzonder-resistente-micro-organismen-zkh"class="external-link">link</a>)</p>
<p>The Dutch national guideline - Rijksinstituut voor Volksgezondheid en
Milieu “WIP-richtlijn BRMO (Bijzonder Resistente Micro-Organismen)
<p>Please suggest your own (country-specific) guidelines by letting us know: <ahref="https://github.com/msberends/AMR/issues/new"class="external-link uri">https://github.com/msberends/AMR/issues/new</a>.</p>
<p>Please suggest your own (country-specific) guidelines by letting us
<p>You can also use your own custom guideline. Custom guidelines can be set with the <code><ahref="../reference/mdro.html">custom_mdro_guideline()</a></code> function. This is of great importance if you have custom rules to determine MDROs in your hospital, e.g., rules that are dependent on ward, state of contact isolation or other variables in your data.</p>
<p>If you are familiar with <code><ahref="https://dplyr.tidyverse.org/reference/case_when.html"class="external-link">case_when()</a></code> of the <code>dplyr</code> package, you will recognise the input method to set your own rules. Rules must be set using what R considers to be the ‘formula notation’:</p>
<p>You can also use your own custom guideline. Custom guidelines can be
set with the <code><ahref="../reference/mdro.html">custom_mdro_guideline()</a></code> function. This is of
great importance if you have custom rules to determine MDROs in your
hospital, e.g., rules that are dependent on ward, state of contact
isolation or other variables in your data.</p>
<p>If you are familiar with <code><ahref="https://dplyr.tidyverse.org/reference/case_when.html"class="external-link">case_when()</a></code> of the
<code>dplyr</code> package, you will recognise the input method to set
your own rules. Rules must be set using what R considers to be the
<codeclass="sourceCode R"><spanclass="va">custom</span><spanclass="op"><-</span><spanclass="fu"><ahref="../reference/mdro.html">custom_mdro_guideline</a></span><spanclass="op">(</span><spanclass="va">CIP</span><spanclass="op">==</span><spanclass="st">"R"</span><spanclass="op">&</span><spanclass="va">age</span><spanclass="op">></span><spanclass="fl">60</span><spanclass="op">~</span><spanclass="st">"Elderly Type A"</span>,
<spanclass="va">ERY</span><spanclass="op">==</span><spanclass="st">"R"</span><spanclass="op">&</span><spanclass="va">age</span><spanclass="op">></span><spanclass="fl">60</span><spanclass="op">~</span><spanclass="st">"Elderly Type B"</span><spanclass="op">)</span></code></pre></div>
<p>If a row/an isolate matches the first rule, the value after the first <code>~</code> (in this case <em>‘Elderly Type A’</em>) will be set as MDRO value. Otherwise, the second rule will be tried and so on. The maximum number of rules is unlimited.</p>
<p>You can print the rules set in the console for an overview. Colours will help reading it if your console supports colours.</p>
<p>If a row/an isolate matches the first rule, the value after the first
<code>~</code> (in this case <em>‘Elderly Type A’</em>) will be set as
MDRO value. Otherwise, the second rule will be tried and so on. The
maximum number of rules is unlimited.</p>
<p>You can print the rules set in the console for an overview. Colours
will help reading it if your console supports colours.</p>
<spanclass="co"># A set of custom MDRO rules:</span>
@ -255,7 +289,8 @@
@@ -255,7 +289,8 @@
<spanclass="co"># </span>
<spanclass="co"># Unmatched rows will return NA.</span>
<spanclass="co"># Results will be of class <factor>, with ordered levels: Negative < Elderly Type A < Elderly Type B</span></code></pre></div>
<p>The outcome of the function can be used for the <code>guideline</code> argument in the <code><ahref="../reference/mdro.html">mdro()</a></code> function:</p>
<p>The outcome of the function can be used for the
<code>guideline</code> argument in the <code><ahref="../reference/mdro.html">mdro()</a></code> function:</p>
<p>The rules set (the <code>custom</code> object in this case) could be exported to a shared file location using <code><ahref="https://rdrr.io/r/base/readRDS.html"class="external-link">saveRDS()</a></code> if you collaborate with multiple users. The custom rules set could then be imported using <code><ahref="https://rdrr.io/r/base/readRDS.html"class="external-link">readRDS()</a></code>.</p>
<p>The rules set (the <code>custom</code> object in this case) could be
exported to a shared file location using <code><ahref="https://rdrr.io/r/base/readRDS.html"class="external-link">saveRDS()</a></code> if you
collaborate with multiple users. The custom rules set could then be
imported using <code><ahref="https://rdrr.io/r/base/readRDS.html"class="external-link">readRDS()</a></code>.</p>
<p>The <code><ahref="../reference/mdro.html">mdro()</a></code> function always returns an ordered <code>factor</code> for predefined guidelines. For example, the output of the default guideline by Magiorakos <em>et al.</em> returns a <code>factor</code> with levels ‘Negative’, ‘MDR’, ‘XDR’ or ‘PDR’ in that order.</p>
<p>The next example uses the <code>example_isolates</code> data set. This is a data set included with this package and contains full antibiograms of 2,000 microbial isolates. It reflects reality and can be used to practise AMR data analysis. If we test the MDR/XDR/PDR guideline on this data set, we get:</p>
<p>The <code><ahref="../reference/mdro.html">mdro()</a></code> function always returns an ordered
<code>factor</code> for predefined guidelines. For example, the output
of the default guideline by Magiorakos <em>et al.</em> returns a
<code>factor</code> with levels ‘Negative’, ‘MDR’, ‘XDR’ or ‘PDR’ in
that order.</p>
<p>The next example uses the <code>example_isolates</code> data set.
This is a data set included with this package and contains full
antibiograms of 2,000 microbial isolates. It reflects reality and can be
used to practise AMR data analysis. If we test the MDR/XDR/PDR guideline
<codeclass="sourceCode R"><spanclass="kw"><ahref="https://rdrr.io/r/base/library.html"class="external-link">library</a></span><spanclass="op">(</span><spanclass="va"><ahref="https://dplyr.tidyverse.org"class="external-link">dplyr</a></span><spanclass="op">)</span><spanclass="co"># to support pipes: %>%</span>
<spanclass="kw"><ahref="https://rdrr.io/r/base/library.html"class="external-link">library</a></span><spanclass="op">(</span><spanclass="va"><ahref="https://github.com/msberends/cleaner"class="external-link">cleaner</a></span><spanclass="op">)</span><spanclass="co"># to create frequency tables</span></code></pre></div>
<spanclass="co"># Warning: in `mdro()`: NA introduced for isolates where the available percentage of</span>
<spanclass="co"># antimicrobial classes was below 50% (set with `pct_required_classes`)</span></code></pre></div>
<p>Only results with ‘R’ are considered as resistance. Use <code>combine_SI = FALSE</code> to also consider ‘I’ as resistance.</p>
<p>Determining multidrug-resistant organisms (MDRO), according to: Guideline: Multidrug-resistant, extensively drug-resistant and pandrug-resistant bacteria: an international expert proposal for interim standard definitions for acquired resistance. Author(s): Magiorakos AP, Srinivasan A, Carey RB, …, Vatopoulos A, Weber JT, Monnet DL Source: Clinical Microbiology and Infection 18:3, 2012; doi: 10.1111/j.1469-0691.2011.03570.x</p>
<p>Only results with ‘R’ are considered as resistance. Use
<code>combine_SI = FALSE</code> to also consider ‘I’ as resistance.</p>
<p>Determining multidrug-resistant organisms (MDRO), according to:
Guideline: Multidrug-resistant, extensively drug-resistant and
pandrug-resistant bacteria: an international expert proposal for interim
standard definitions for acquired resistance. Author(s): Magiorakos AP,
Srinivasan A, Carey RB, …, Vatopoulos A, Weber JT, Monnet DL Source:
Clinical Microbiology and Infection 18:3, 2012; doi:
<spanclass="fu"><ahref="https://dplyr.tidyverse.org/reference/group_by.html"class="external-link">group_by</a></span><spanclass="op">(</span>order <spanclass="op">=</span><spanclass="fu"><ahref="../reference/mo_property.html">mo_order</a></span><spanclass="op">(</span><spanclass="va">mo</span><spanclass="op">)</span>, <spanclass="co"># group on anything, like order</span>
@ -286,24 +290,31 @@
@@ -286,24 +290,31 @@
<divclass="section level2">
<h2id="perform-principal-component-analysis">Perform principal component analysis<aclass="anchor"aria-label="anchor"href="#perform-principal-component-analysis"></a>
</h2>
<p>The new <code><ahref="../reference/pca.html">pca()</a></code> function will automatically filter on rows that contain numeric values in all selected variables, so we now only need to do:</p>
<p>The new <code><ahref="../reference/pca.html">pca()</a></code> function will automatically filter on rows
that contain numeric values in all selected variables, so we now only
<spanclass="co"># and "TOB". Total observations available: 7.</span></code></pre></div>
<p>The result can be reviewed with the good old <code><ahref="https://rdrr.io/r/base/summary.html"class="external-link">summary()</a></code> function:</p>
<p>The result can be reviewed with the good old <code><ahref="https://rdrr.io/r/base/summary.html"class="external-link">summary()</a></code>
<p>Good news. The first two components explain a total of 93.3% of the variance (see the PC1 and PC2 values of the <em>Proportion of Variance</em>. We can create a so-called biplot with the base R <code><ahref="https://rdrr.io/r/stats/biplot.html"class="external-link">biplot()</a></code> function, to see which antimicrobial resistance per drug explain the difference per microorganism.</p>
<p>Good news. The first two components explain a total of 93.3% of the
variance (see the PC1 and PC2 values of the <em>Proportion of
Variance</em>. We can create a so-called biplot with the base R
<code><ahref="https://rdrr.io/r/stats/biplot.html"class="external-link">biplot()</a></code> function, to see which antimicrobial resistance
per drug explain the difference per microorganism.</p>
</div>
<divclass="section level2">
<h2id="plotting-the-results">Plotting the results<aclass="anchor"aria-label="anchor"href="#plotting-the-results"></a>
<p>But we can’t see the explanation of the points. Perhaps this works better with our new <code><ahref="../reference/ggplot_pca.html">ggplot_pca()</a></code> function, that automatically adds the right labels and even groups:</p>
<p>But we can’t see the explanation of the points. Perhaps this works
better with our new <code><ahref="../reference/ggplot_pca.html">ggplot_pca()</a></code> function, that
automatically adds the right labels and even groups:</p>
<h2id="spss-sas-stata">SPSS / SAS / Stata<aclass="anchor"aria-label="anchor"href="#spss-sas-stata"></a>
</h2>
<p>SPSS (Statistical Package for the Social Sciences) is probably the most well-known software package for statistical analysis. SPSS is easier to learn than R, because in SPSS you only have to click a menu to run parts of your analysis. Because of its user-friendliness, it is taught at universities and particularly useful for students who are new to statistics. From my experience, I would guess that pretty much all (bio)medical students know it at the time they graduate. SAS and Stata are comparable statistical packages popular in big industries.</p>
<p>SPSS (Statistical Package for the Social Sciences) is probably the
most well-known software package for statistical analysis. SPSS is
easier to learn than R, because in SPSS you only have to click a menu to
run parts of your analysis. Because of its user-friendliness, it is
taught at universities and particularly useful for students who are new
to statistics. From my experience, I would guess that pretty much all
(bio)medical students know it at the time they graduate. SAS and Stata
are comparable statistical packages popular in big industries.</p>
</div>
<divclass="section level2">
<h2id="compared-to-r">Compared to R<aclass="anchor"aria-label="anchor"href="#compared-to-r"></a>
</h2>
<p>As said, SPSS is easier to learn than R. But SPSS, SAS and Stata come with major downsides when comparing it with R:</p>
<p>As said, SPSS is easier to learn than R. But SPSS, SAS and Stata come
with major downsides when comparing it with R:</p>
<ul>
<li>
<p><strong>R is highly modular.</strong></p>
<p>The <ahref="https://cran.r-project.org/"class="external-link">official R network (CRAN)</a> features more than 16,000 packages at the time of writing, our <code>AMR</code> package being one of them. All these packages were peer-reviewed before publication. Aside from this official channel, there are also developers who choose not to submit to CRAN, but rather keep it on their own public repository, like GitHub. So there may even be a lot more than 14,000 packages out there.</p>
<p>Bottom line is, you can really extend it yourself or ask somebody to do this for you. Take for example our <code>AMR</code> package. Among other things, it adds reliable reference data to R to help you with the data cleaning and analysis. SPSS, SAS and Stata will never know what a valid MIC value is or what the Gram stain of <em>E. coli</em> is. Or that all species of <em>Klebiella</em> are resistant to amoxicillin and that Floxapen<sup>®</sup> is a trade name of flucloxacillin. These facts and properties are often needed to clean existing data, which would be very inconvenient in a software package without reliable reference data. See below for a demonstration.</p>
<p>The <ahref="https://cran.r-project.org/"class="external-link">official R network
(CRAN)</a> features more than 16,000 packages at the time of writing,
our <code>AMR</code> package being one of them. All these packages were
peer-reviewed before publication. Aside from this official channel,
there are also developers who choose not to submit to CRAN, but rather
keep it on their own public repository, like GitHub. So there may even
be a lot more than 14,000 packages out there.</p>
<p>Bottom line is, you can really extend it yourself or ask somebody to
do this for you. Take for example our <code>AMR</code> package. Among
other things, it adds reliable reference data to R to help you with the
data cleaning and analysis. SPSS, SAS and Stata will never know what a
valid MIC value is or what the Gram stain of <em>E. coli</em> is. Or
that all species of <em>Klebiella</em> are resistant to amoxicillin and
that Floxapen<sup>®</sup> is a trade name of flucloxacillin. These facts
and properties are often needed to clean existing data, which would be
very inconvenient in a software package without reliable reference data.
See below for a demonstration.</p>
</li>
<li>
<p><strong>R is extremely flexible.</strong></p>
<p>Because you write the syntax yourself, you can do anything you want. The flexibility in transforming, arranging, grouping and summarising data, or drawing plots, is endless - with SPSS, SAS or Stata you are bound to their algorithms and format styles. They may be a bit flexible, but you can probably never create that very specific publication-ready plot without using other (paid) software. If you sometimes write syntaxes in SPSS to run a complete analysis or to ‘automate’ some of your work, you could do this a lot less time in R. You will notice that writing syntaxes in R is a lot more nifty and clever than in SPSS. Still, as working with any statistical package, you will have to have knowledge about what you are doing (statistically) and what you are willing to accomplish.</p>
<p>Because you write the syntax yourself, you can do anything you want.
The flexibility in transforming, arranging, grouping and summarising
data, or drawing plots, is endless - with SPSS, SAS or Stata you are
bound to their algorithms and format styles. They may be a bit flexible,
but you can probably never create that very specific publication-ready
plot without using other (paid) software. If you sometimes write
syntaxes in SPSS to run a complete analysis or to ‘automate’ some of
your work, you could do this a lot less time in R. You will notice that
writing syntaxes in R is a lot more nifty and clever than in SPSS.
Still, as working with any statistical package, you will have to have
knowledge about what you are doing (statistically) and what you are
willing to accomplish.</p>
</li>
<li>
<p><strong>R can be easily automated.</strong></p>
<p>Over the last years, <ahref="https://rmarkdown.rstudio.com/"class="external-link">R Markdown</a> has really made an interesting development. With R Markdown, you can very easily produce reports, whether the format has to be Word, PowerPoint, a website, a PDF document or just the raw data to Excel. It even allows the use of a reference file containing the layout style (e.g.fonts and colours) of your organisation. I use this a lot to generate weekly and monthly reports automatically. Just write the code once and enjoy the automatically updated reports at any interval you like.</p>
<p>For an even more professional environment, you could create <ahref="https://shiny.rstudio.com/"class="external-link">Shiny apps</a>: live manipulation of data using a custom made website. The webdesign knowledge needed (JavaScript, CSS, HTML) is almost <em>zero</em>.</p>
<p>Over the last years, <ahref="https://rmarkdown.rstudio.com/"class="external-link">R
Markdown</a> has really made an interesting development. With R
Markdown, you can very easily produce reports, whether the format has to
be Word, PowerPoint, a website, a PDF document or just the raw data to
Excel. It even allows the use of a reference file containing the layout
style (e.g.fonts and colours) of your organisation. I use this a lot to
generate weekly and monthly reports automatically. Just write the code
once and enjoy the automatically updated reports at any interval you
like.</p>
<p>For an even more professional environment, you could create <ahref="https://shiny.rstudio.com/"class="external-link">Shiny apps</a>: live manipulation of
data using a custom made website. The webdesign knowledge needed
(JavaScript, CSS, HTML) is almost <em>zero</em>.</p>
</li>
<li>
<p><strong>R has a huge community.</strong></p>
<p>Many R users just ask questions on websites like <ahref="https://stackoverflow.com"class="external-link">StackOverflow.com</a>, the largest online community for programmers. At the time of writing, <ahref="https://stackoverflow.com/questions/tagged/r?sort=votes"class="external-link">440,893 R-related questions</a> have already been asked on this platform (that covers questions and answers for any programming language). In my own experience, most questions are answered within a couple of minutes.</p>
<p>Many R users just ask questions on websites like <ahref="https://stackoverflow.com"class="external-link">StackOverflow.com</a>, the largest
online community for programmers. At the time of writing, <ahref="https://stackoverflow.com/questions/tagged/r?sort=votes"class="external-link">447,735
R-related questions</a> have already been asked on this platform (that
covers questions and answers for any programming language). In my own
experience, most questions are answered within a couple of
minutes.</p>
</li>
<li>
<p><strong>R understands any data type, including SPSS/SAS/Stata.</strong></p>
<p>And that’s not vice versa I’m afraid. You can import data from any source into R. For example from SPSS, SAS and Stata (<ahref="https://haven.tidyverse.org/"class="external-link">link</a>), from Minitab, Epi Info and EpiData (<ahref="https://cran.r-project.org/package=foreign"class="external-link">link</a>), from Excel (<ahref="https://readxl.tidyverse.org/"class="external-link">link</a>), from flat files like CSV, TXT or TSV (<ahref="https://readr.tidyverse.org/"class="external-link">link</a>), or directly from databases and datawarehouses from anywhere on the world (<ahref="https://dbplyr.tidyverse.org/"class="external-link">link</a>). You can even scrape websites to download tables that are live on the internet (<ahref="https://github.com/hadley/rvest"class="external-link">link</a>) or get the results of an API call and transform it into data in only one command (<ahref="https://github.com/Rdatatable/data.table/wiki/Convenience-features-of-fread"class="external-link">link</a>).</p>
<p>And the best part - you can export from R to most data formats as well. So you can import an SPSS file, do your analysis neatly in R and export the resulting tables to Excel files for sharing.</p>
<p><strong>R understands any data type, including
SPSS/SAS/Stata.</strong></p>
<p>And that’s not vice versa I’m afraid. You can import data from any
source into R. For example from SPSS, SAS and Stata (<ahref="https://haven.tidyverse.org/"class="external-link">link</a>), from Minitab, Epi Info
and EpiData (<ahref="https://cran.r-project.org/package=foreign"class="external-link">link</a>), from Excel
(<ahref="https://readxl.tidyverse.org/"class="external-link">link</a>), from flat files like
CSV, TXT or TSV (<ahref="https://readr.tidyverse.org/"class="external-link">link</a>), or
directly from databases and datawarehouses from anywhere on the world
(<ahref="https://dbplyr.tidyverse.org/"class="external-link">link</a>). You can even scrape
websites to download tables that are live on the internet (<ahref="https://github.com/hadley/rvest"class="external-link">link</a>) or get the results of
an API call and transform it into data in only one command (<ahref="https://github.com/Rdatatable/data.table/wiki/Convenience-features-of-fread"class="external-link">link</a>).</p>
<p>And the best part - you can export from R to most data formats as
well. So you can import an SPSS file, do your analysis neatly in R and
export the resulting tables to Excel files for sharing.</p>
</li>
<li>
<p><strong>R is completely free and open-source.</strong></p>
<p>No strings attached. It was created and is being maintained by volunteers who believe that (data) science should be open and publicly available to everybody. SPSS, SAS and Stata are quite expensive. IBM SPSS Staticstics only comes with subscriptions nowadays, varying <ahref="https://www.ibm.com/products/spss-statistics/pricing"class="external-link">between USD 1,300 and USD 8,500</a> per user <em>per year</em>. SAS Analytics Pro costs <ahref="https://www.sas.com/store/products-solutions/sas-analytics-pro/prodPERSANL.html"class="external-link">around USD 10,000</a> per computer. Stata also has a business model with subscription fees, varying <ahref="https://www.stata.com/order/new/bus/single-user-licenses/dl/"class="external-link">between USD 600 and USD 2,800</a> per computer per year, but lower prices come with a limitation of the number of variables you can work with. And still they do not offer the above benefits of R.</p>
<p>If you are working at a midsized or small company, you can save it tens of thousands of dollars by using R instead of e.g.SPSS - gaining even more functions and flexibility. And all R enthousiasts can do as much PR as they want (like I do here), because nobody is officially associated with or affiliated by R. It is really free.</p>
<p>No strings attached. It was created and is being maintained by
volunteers who believe that (data) science should be open and publicly
available to everybody. SPSS, SAS and Stata are quite expensive. IBM
SPSS Staticstics only comes with subscriptions nowadays, varying <ahref="https://www.ibm.com/products/spss-statistics/pricing"class="external-link">between USD
1,300 and USD 8,500</a> per user <em>per year</em>. SAS Analytics Pro
USD 600 and USD 2,800</a> per computer per year, but lower prices come
with a limitation of the number of variables you can work with. And
still they do not offer the above benefits of R.</p>
<p>If you are working at a midsized or small company, you can save it
tens of thousands of dollars by using R instead of e.g.SPSS - gaining
even more functions and flexibility. And all R enthousiasts can do as
much PR as they want (like I do here), because nobody is officially
associated with or affiliated by R. It is really free.</p>
</li>
<li>
<p><strong>R is (nowadays) the preferred analysis software in academic papers.</strong></p>
<p>At present, R is among the world most powerful statistical languages, and it is generally very popular in science (Bollmann <em>et al.</em>, 2017). For all the above reasons, the number of references to R as an analysis method in academic papers <ahref="https://r4stats.com/2014/08/20/r-passes-spss-in-scholarly-use-stata-growing-rapidly/"class="external-link">is rising continuously</a> and has even surpassed SPSS for academic use (Muenchen, 2014).</p>
<p>I believe that the thing with SPSS is, that it has always had a great user interface which is very easy to learn and use. Back when they developed it, they had very little competition, let alone from R. R didn’t even had a professional user interface until the last decade (called RStudio, see below). How people used R between the nineties and 2010 is almost completely incomparable to how R is being used now. The language itself <ahref="https://www.tidyverse.org/packages/"class="external-link">has been restyled completely</a> by volunteers who are dedicated professionals in the field of data science. SPSS was great when there was nothing else that could compete. But now in 2022, I don’t see any reason why SPSS would be of any better use than R.</p>
<p><strong>R is (nowadays) the preferred analysis software in
academic papers.</strong></p>
<p>At present, R is among the world most powerful statistical languages,
and it is generally very popular in science (Bollmann <em>et al.</em>,
2017). For all the above reasons, the number of references to R as an
analysis method in academic papers <ahref="https://r4stats.com/2014/08/20/r-passes-spss-in-scholarly-use-stata-growing-rapidly/"class="external-link">is
rising continuously</a> and has even surpassed SPSS for academic use
(Muenchen, 2014).</p>
<p>I believe that the thing with SPSS is, that it has always had a great
user interface which is very easy to learn and use. Back when they
developed it, they had very little competition, let alone from R. R
didn’t even had a professional user interface until the last decade
(called RStudio, see below). How people used R between the nineties and
2010 is almost completely incomparable to how R is being used now. The
language itself <ahref="https://www.tidyverse.org/packages/"class="external-link">has been
restyled completely</a> by volunteers who are dedicated professionals in
the field of data science. SPSS was great when there was nothing else
that could compete. But now in 2022, I don’t see any reason why SPSS
<p>To work with R, probably the best option is to use <ahref="https://www.rstudio.com/products/rstudio/"class="external-link">RStudio</a>. It is an open-source and free desktop environment which not only allows you to run R code, but also supports project management, version management, package management and convenient import menus to work with other data sources. You can also install <ahref="https://www.rstudio.com/products/rstudio/"class="external-link">RStudio Server</a> on a private or corporate server, which brings nothing less than the complete RStudio software to you as a website (at home or at work).</p>
<p>To import a data file, just click <em>Import Dataset</em> in the Environment tab:</p>
<p>To work with R, probably the best option is to use <ahref="https://www.rstudio.com/products/rstudio/"class="external-link">RStudio</a>. It is an
open-source and free desktop environment which not only allows you to
run R code, but also supports project management, version management,
package management and convenient import menus to work with other data
sources. You can also install <ahref="https://www.rstudio.com/products/rstudio/"class="external-link">RStudio Server</a> on a
private or corporate server, which brings nothing less than the complete
RStudio software to you as a website (at home or at work).</p>
<p>To import a data file, just click <em>Import Dataset</em> in the
<p>If you want named variables to be imported as factors so it resembles SPSS more, use <code><ahref="https://haven.tidyverse.org/reference/as_factor.html"class="external-link">as_factor()</a></code>.</p>
<p>If you want named variables to be imported as factors so it resembles
SPSS more, use <code><ahref="https://haven.tidyverse.org/reference/as_factor.html"class="external-link">as_factor()</a></code>.</p>
<p>To import data from SPSS, SAS or Stata, you can use the <ahref="https://haven.tidyverse.org/"class="external-link">great <code>haven</code> package</a> yourself:</p>
<p>To import data from SPSS, SAS or Stata, you can use the <ahref="https://haven.tidyverse.org/"class="external-link">great <code>haven</code> package</a>