(v0.8.0.9021) update vignettes
@ -1,6 +1,6 @@
|
|||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 0.8.0.9017
|
Version: 0.8.0.9021
|
||||||
Date: 2019-11-06
|
Date: 2019-11-09
|
||||||
Title: Antimicrobial Resistance Analysis
|
Title: Antimicrobial Resistance Analysis
|
||||||
Authors@R: c(
|
Authors@R: c(
|
||||||
person(role = c("aut", "cre"),
|
person(role = c("aut", "cre"),
|
||||||
|
4
NEWS.md
@ -1,5 +1,5 @@
|
|||||||
# AMR 0.8.0.9017
|
# AMR 0.8.0.9021
|
||||||
<small>Last updated: 06-Nov-2019</small>
|
<small>Last updated: 09-Nov-2019</small>
|
||||||
|
|
||||||
### New
|
### New
|
||||||
* Support for a new MDRO guideline: Magiorakos AP, Srinivasan A *et al.* "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).
|
* Support for a new MDRO guideline: Magiorakos AP, Srinivasan A *et al.* "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).
|
||||||
|
2
R/ab.R
@ -75,7 +75,7 @@ as.ab <- function(x, ...) {
|
|||||||
# remove suffices
|
# remove suffices
|
||||||
x_bak_clean <- gsub("_(mic|rsi|dis[ck])$", "", x, ignore.case = TRUE)
|
x_bak_clean <- gsub("_(mic|rsi|dis[ck])$", "", x, ignore.case = TRUE)
|
||||||
# remove disk concentrations, like LVX_NM -> LVX
|
# remove disk concentrations, like LVX_NM -> LVX
|
||||||
x_bak_clean <- gsub("_[A-Z]{2}[0-9_]{0,3}$", "", x_bak_clean, ignore.case = TRUE)
|
x_bak_clean <- gsub("_[A-Z]{2}[0-9_.]{0,3}$", "", x_bak_clean, ignore.case = TRUE)
|
||||||
# remove part between brackets if that's followed by another string
|
# remove part between brackets if that's followed by another string
|
||||||
x_bak_clean <- gsub("(.*)+ [(].*[)]", "\\1", x_bak_clean)
|
x_bak_clean <- gsub("(.*)+ [(].*[)]", "\\1", x_bak_clean)
|
||||||
# keep only max 1 space
|
# keep only max 1 space
|
||||||
|
@ -241,11 +241,11 @@ eucast_rules <- function(x,
|
|||||||
warned <- FALSE
|
warned <- FALSE
|
||||||
|
|
||||||
txt_error <- function() {
|
txt_error <- function() {
|
||||||
cat("", bgRed(white(" ERROR ")), "\n\n")
|
if (info == TRUE) cat("", bgRed(white(" ERROR ")), "\n\n")
|
||||||
}
|
}
|
||||||
txt_warning <- function() {
|
txt_warning <- function() {
|
||||||
if (warned == FALSE) {
|
if (warned == FALSE) {
|
||||||
cat("", bgYellow(black(" WARNING ")))
|
if (info == TRUE) cat("", bgYellow(black(" WARNING ")))
|
||||||
}
|
}
|
||||||
warned <<- TRUE
|
warned <<- TRUE
|
||||||
}
|
}
|
||||||
|
@ -42,8 +42,10 @@ environment:
|
|||||||
USE_RTOOLS: true
|
USE_RTOOLS: true
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
|
- R_VERSION: oldrel
|
||||||
- R_VERSION: release
|
- R_VERSION: release
|
||||||
- R_VERSION: devel
|
allow_failures:
|
||||||
|
- R_VERSION: devel
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
- travis_tool.sh install_deps
|
- travis_tool.sh install_deps
|
||||||
|
@ -84,7 +84,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="https://msberends.gitlab.io/AMR/index.html">AMR (for R)</a>
|
<a class="navbar-link" href="https://msberends.gitlab.io/AMR/index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9017</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9021</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9017</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9021</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 102 KiB |
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 83 KiB |
@ -41,7 +41,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9021</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -187,7 +187,7 @@
|
|||||||
<h1>How to apply EUCAST rules</h1>
|
<h1>How to apply EUCAST rules</h1>
|
||||||
<h4 class="author">Matthijs S. Berends</h4>
|
<h4 class="author">Matthijs S. Berends</h4>
|
||||||
|
|
||||||
<h4 class="date">16 October 2019</h4>
|
<h4 class="date">09 November 2019</h4>
|
||||||
|
|
||||||
|
|
||||||
<div class="hidden name"><code>EUCAST.Rmd</code></div>
|
<div class="hidden name"><code>EUCAST.Rmd</code></div>
|
||||||
@ -204,17 +204,24 @@
|
|||||||
<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>
|
</blockquote>
|
||||||
<p>In Europe, a lot of medical microbiological laboratories already apply these rules (<a href="https://www.eurosurveillance.org/content/10.2807/1560-7917.ES2015.20.2.21008">Brown <em>et al.</em>, 2015</a>). Our package features their latest insights on intrinsic resistance and exceptional phenotypes (version 9.0, 2019). Moreover, the <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> function we use for this purpose can also apply additional rules, like forcing <help title="ATC: J01CA01">ampicillin</help> = R in isolates when <help title="ATC: J01CR02">amoxicillin/clavulanic acid</help> = R.</p>
|
<p>In Europe, a lot of medical microbiological laboratories already apply these rules (<a href="https://www.eurosurveillance.org/content/10.2807/1560-7917.ES2015.20.2.21008">Brown <em>et al.</em>, 2015</a>). Our package features their latest insights on intrinsic resistance and exceptional phenotypes (version 9.0, 2019). Moreover, the <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> function we use for this purpose can also apply additional rules, like forcing <help title="ATC: J01CA01">ampicillin</help> = R in isolates when <help title="ATC: J01CR02">amoxicillin/clavulanic acid</help> = R.</p>
|
||||||
<p><em>(more will be available soon)</em></p>
|
|
||||||
<div id="benefit-for-empiric-therapy-success-estimation" class="section level3">
|
|
||||||
<h3 class="hasAnchor">
|
|
||||||
<a href="#benefit-for-empiric-therapy-success-estimation" class="anchor"></a>Benefit for empiric therapy success estimation</h3>
|
|
||||||
<p><em>(will be available soon)</em></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div id="examples" class="section level2">
|
<div id="examples" class="section level2">
|
||||||
<h2 class="hasAnchor">
|
<h2 class="hasAnchor">
|
||||||
<a href="#examples" class="anchor"></a>Examples</h2>
|
<a href="#examples" class="anchor"></a>Examples</h2>
|
||||||
<p><em>(will be available soon)</em></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, 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 solves this:</p>
|
||||||
|
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" data-line-number="1">oops <-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span>(<span class="dt">mo =</span> <span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"Klebsiella"</span>, </a>
|
||||||
|
<a class="sourceLine" id="cb1-2" data-line-number="2"> <span class="st">"Escherichia"</span>),</a>
|
||||||
|
<a class="sourceLine" id="cb1-3" data-line-number="3"> <span class="dt">ampicillin =</span> <span class="st">"S"</span>)</a>
|
||||||
|
<a class="sourceLine" id="cb1-4" data-line-number="4">oops</a>
|
||||||
|
<a class="sourceLine" id="cb1-5" data-line-number="5"><span class="co"># mo ampicillin</span></a>
|
||||||
|
<a class="sourceLine" id="cb1-6" data-line-number="6"><span class="co"># 1 Klebsiella S</span></a>
|
||||||
|
<a class="sourceLine" id="cb1-7" data-line-number="7"><span class="co"># 2 Escherichia S</span></a>
|
||||||
|
<a class="sourceLine" id="cb1-8" data-line-number="8"></a>
|
||||||
|
<a class="sourceLine" id="cb1-9" data-line-number="9"><span class="kw"><a href="../reference/eucast_rules.html">eucast_rules</a></span>(oops, <span class="dt">info =</span> <span class="ot">FALSE</span>)</a>
|
||||||
|
<a class="sourceLine" id="cb1-10" data-line-number="10"><span class="co"># mo ampicillin</span></a>
|
||||||
|
<a class="sourceLine" id="cb1-11" data-line-number="11"><span class="co"># 1 Klebsiella R</span></a>
|
||||||
|
<a class="sourceLine" id="cb1-12" data-line-number="12"><span class="co"># 2 Escherichia S</span></a></code></pre></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9021</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -187,7 +187,7 @@
|
|||||||
<h1>How to determine multi-drug resistance (MDR)</h1>
|
<h1>How to determine multi-drug resistance (MDR)</h1>
|
||||||
<h4 class="author">Matthijs S. Berends</h4>
|
<h4 class="author">Matthijs S. Berends</h4>
|
||||||
|
|
||||||
<h4 class="date">16 October 2019</h4>
|
<h4 class="date">09 November 2019</h4>
|
||||||
|
|
||||||
|
|
||||||
<div class="hidden name"><code>MDR.Rmd</code></div>
|
<div class="hidden name"><code>MDR.Rmd</code></div>
|
||||||
@ -196,67 +196,148 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<p>With the function <code><a href="../reference/mdro.html">mdro()</a></code>, you can determine multi-drug resistant organisms (MDRO). It currently support these guidelines:</p>
|
<p>With the function <code><a href="../reference/mdro.html">mdro()</a></code>, you can determine multi-drug resistant organisms (MDRO).</p>
|
||||||
|
<div id="type-of-input" class="section level4">
|
||||||
|
<h4 class="hasAnchor">
|
||||||
|
<a href="#type-of-input" class="anchor"></a>Type of input</h4>
|
||||||
|
<p>The <code><a href="../reference/mdro.html">mdro()</a></code> takes a data set as input, such as a regular <code>data.frame</code>. It automatically determines the right columns for info about your isolates, like 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><a href="../reference/mdro.html">?mdro</a></code>.</p>
|
||||||
|
<p>For WHONET data (and most other data), all settings are automatically set correctly.</p>
|
||||||
|
</div>
|
||||||
|
<div id="guidelines" class="section level4">
|
||||||
|
<h4 class="hasAnchor">
|
||||||
|
<a href="#guidelines" class="anchor"></a>Guidelines</h4>
|
||||||
|
<p>The function support multiple guidelines. You can select a guideline with the <code>guideline</code> parameter. Currently supported guidelines are (case-insensitive):</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>“Intrinsic Resistance and Exceptional Phenotypes Tables”, by EUCAST (European Committee on Antimicrobial Susceptibility Testing)</li>
|
<li>
|
||||||
<li>“Companion handbook to the WHO guidelines for the programmatic management of drug-resistant tuberculosis”, by WHO (World Health Organization)</li>
|
<p><code>guideline = "CMI2012"</code> (default)</p>
|
||||||
<li>“WIP-Richtlijn Bijzonder Resistente Micro-organismen (BRMO)”, by RIVM (Rijksinstituut voor de Volksgezondheid, the Netherlands National Institute for Public Health and the Environment)</li>
|
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) (<a href="https://www.clinicalmicrobiologyandinfection.com/article/S1198-743X(14)61632-3/fulltext">link</a>)</li>
|
||||||
|
<li>
|
||||||
|
<p><code>guideline = "EUCAST"</code></p>
|
||||||
|
The European international guideline - EUCAST Expert Rules Version 3.1 “Intrinsic Resistance and Exceptional Phenotypes Tables” (<a href="http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf">link</a>)</li>
|
||||||
|
<li>
|
||||||
|
<p><code>guideline = "TB"</code></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” (<a href="https://www.who.int/tb/publications/pmdt_companionhandbook/en/">link</a>)</li>
|
||||||
|
<li>
|
||||||
|
<p><code>guideline = "MRGN"</code></p>
|
||||||
|
The German national guideline - Mueller et al. (2015) Antimicrobial Resistance and Infection Control 4:7. (<a href="https://doi.org/10.1186/s13756-015-0047-6">link</a>)</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]” (<a href="https://www.rivm.nl/Documenten_en_publicaties/Professioneel_Praktisch/Richtlijnen/Infectieziekten/WIP_Richtlijnen/WIP_Richtlijnen/Ziekenhuizen/WIP_richtlijn_BRMO_Bijzonder_Resistente_Micro_Organismen_ZKH">link</a>)</p>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>As an example, I will make a data set to determine multi-drug resistant TB:</p>
|
</div>
|
||||||
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="co"># a helper function to get a random vector with values S, I and R</span></a>
|
<div id="examples" class="section level4">
|
||||||
<a class="sourceLine" id="cb1-2" data-line-number="2"><span class="co"># with the probabilities 50% - 10% - 40%</span></a>
|
<h4 class="hasAnchor">
|
||||||
<a class="sourceLine" id="cb1-3" data-line-number="3">sample_rsi <-<span class="st"> </span><span class="cf">function</span>() {</a>
|
<a href="#examples" class="anchor"></a>Examples</h4>
|
||||||
<a class="sourceLine" id="cb1-4" data-line-number="4"> <span class="kw"><a href="https://rdrr.io/r/base/sample.html">sample</a></span>(<span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"S"</span>, <span class="st">"I"</span>, <span class="st">"R"</span>),</a>
|
<p>The <code><a href="../reference/mdro.html">mdro()</a></code> function always returns an ordered <code>factor</code>. 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. If we test that guideline on the included <code>example_isolates</code> data set, we get:</p>
|
||||||
<a class="sourceLine" id="cb1-5" data-line-number="5"> <span class="dt">size =</span> <span class="dv">5000</span>,</a>
|
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(dplyr) <span class="co"># to support pipes: %>%</span></a></code></pre></div>
|
||||||
<a class="sourceLine" id="cb1-6" data-line-number="6"> <span class="dt">prob =</span> <span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="fl">0.5</span>, <span class="fl">0.1</span>, <span class="fl">0.4</span>),</a>
|
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" data-line-number="1">example_isolates <span class="op">%>%</span><span class="st"> </span></a>
|
||||||
<a class="sourceLine" id="cb1-7" data-line-number="7"> <span class="dt">replace =</span> <span class="ot">TRUE</span>)</a>
|
<a class="sourceLine" id="cb2-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="../reference/mdro.html">mdro</a></span>() <span class="op">%>%</span><span class="st"> </span></a>
|
||||||
<a class="sourceLine" id="cb1-8" data-line-number="8">}</a>
|
<a class="sourceLine" id="cb2-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>() <span class="co"># show frequency table of the result</span></a>
|
||||||
<a class="sourceLine" id="cb1-9" data-line-number="9"></a>
|
<a class="sourceLine" id="cb2-4" data-line-number="4"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `mo` as input for `col_mo`.</span></a>
|
||||||
<a class="sourceLine" id="cb1-10" data-line-number="10">my_TB_data <-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span>(<span class="dt">rifampicin =</span> <span class="kw">sample_rsi</span>(),</a>
|
<a class="sourceLine" id="cb2-5" data-line-number="5"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Auto-guessing columns suitable for analysis...OK.</span></a>
|
||||||
<a class="sourceLine" id="cb1-11" data-line-number="11"> <span class="dt">isoniazid =</span> <span class="kw">sample_rsi</span>(),</a>
|
<a class="sourceLine" id="cb2-6" data-line-number="6"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Reliability will be improved if these antimicrobial results would be available too: SAM (ampicillin/sulbactam), ATM (aztreonam), CTT (cefotetan), CPT (ceftaroline), DAP (daptomycin), DOR (doripenem), ETP (ertapenem), FUS (fusidic acid), GEH (gentamicin-high), LVX (levofloxacin), MNO (minocycline), NET (netilmicin), PLB (polymyxin B), QDA (quinupristin/dalfopristin), STH (streptomycin-high), TLV (telavancin), TCC (ticarcillin/clavulanic acid)</span></a>
|
||||||
<a class="sourceLine" id="cb1-12" data-line-number="12"> <span class="dt">gatifloxacin =</span> <span class="kw">sample_rsi</span>(),</a>
|
<a class="sourceLine" id="cb2-7" data-line-number="7"><span class="co"># Table 1 - S. aureus ... OK</span></a>
|
||||||
<a class="sourceLine" id="cb1-13" data-line-number="13"> <span class="dt">ethambutol =</span> <span class="kw">sample_rsi</span>(),</a>
|
<a class="sourceLine" id="cb2-8" data-line-number="8"><span class="co"># Table 2 - Enterococcus spp. ... OK</span></a>
|
||||||
<a class="sourceLine" id="cb1-14" data-line-number="14"> <span class="dt">pyrazinamide =</span> <span class="kw">sample_rsi</span>(),</a>
|
<a class="sourceLine" id="cb2-9" data-line-number="9"><span class="co"># Table 3 - Enterobacteriaceae ... OK</span></a>
|
||||||
<a class="sourceLine" id="cb1-15" data-line-number="15"> <span class="dt">moxifloxacin =</span> <span class="kw">sample_rsi</span>(),</a>
|
<a class="sourceLine" id="cb2-10" data-line-number="10"><span class="co"># Table 4 - Pseudomonas aeruginosa ... OK</span></a>
|
||||||
<a class="sourceLine" id="cb1-16" data-line-number="16"> <span class="dt">kanamycin =</span> <span class="kw">sample_rsi</span>())</a></code></pre></div>
|
<a class="sourceLine" id="cb2-11" data-line-number="11"><span class="co"># Table 5 - Acinetobacter spp. ... OK</span></a>
|
||||||
|
<a class="sourceLine" id="cb2-12" data-line-number="12"><span class="co"># Warning in mdro(.): NA introduced for isolates where the available</span></a>
|
||||||
|
<a class="sourceLine" id="cb2-13" data-line-number="13"><span class="co"># percentage of antimicrobial classes was below 50% (set with</span></a>
|
||||||
|
<a class="sourceLine" id="cb2-14" data-line-number="14"><span class="co"># `pct_required_classes`)</span></a></code></pre></div>
|
||||||
|
<p><strong>Frequency table</strong></p>
|
||||||
|
<p>Class: factor > ordered (numeric)<br>
|
||||||
|
Length: 2,000 (of which NA: 289 = 14.45%)<br>
|
||||||
|
Levels: 4: Negative < Multi-drug-resistant (MDR) < Extensively drug-resistant …<br>
|
||||||
|
Unique: 2</p>
|
||||||
|
<table class="table">
|
||||||
|
<thead><tr class="header">
|
||||||
|
<th align="left"></th>
|
||||||
|
<th align="left">Item</th>
|
||||||
|
<th align="right">Count</th>
|
||||||
|
<th align="right">Percent</th>
|
||||||
|
<th align="right">Cum. Count</th>
|
||||||
|
<th align="right">Cum. Percent</th>
|
||||||
|
</tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr class="odd">
|
||||||
|
<td align="left">1</td>
|
||||||
|
<td align="left">Negative</td>
|
||||||
|
<td align="right">1596</td>
|
||||||
|
<td align="right">93.28%</td>
|
||||||
|
<td align="right">1596</td>
|
||||||
|
<td align="right">93.28%</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td align="left">2</td>
|
||||||
|
<td align="left">Multi-drug-resistant (MDR)</td>
|
||||||
|
<td align="right">115</td>
|
||||||
|
<td align="right">6.72%</td>
|
||||||
|
<td align="right">1711</td>
|
||||||
|
<td align="right">100.00%</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>For another example, I will create a data set to determine multi-drug resistant TB:</p>
|
||||||
|
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" data-line-number="1"><span class="co"># a helper function to get a random vector with values S, I and R</span></a>
|
||||||
|
<a class="sourceLine" id="cb3-2" data-line-number="2"><span class="co"># with the probabilities 50% - 10% - 40%</span></a>
|
||||||
|
<a class="sourceLine" id="cb3-3" data-line-number="3">sample_rsi <-<span class="st"> </span><span class="cf">function</span>() {</a>
|
||||||
|
<a class="sourceLine" id="cb3-4" data-line-number="4"> <span class="kw"><a href="https://dplyr.tidyverse.org/reference/sample.html">sample</a></span>(<span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"S"</span>, <span class="st">"I"</span>, <span class="st">"R"</span>),</a>
|
||||||
|
<a class="sourceLine" id="cb3-5" data-line-number="5"> <span class="dt">size =</span> <span class="dv">5000</span>,</a>
|
||||||
|
<a class="sourceLine" id="cb3-6" data-line-number="6"> <span class="dt">prob =</span> <span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="fl">0.5</span>, <span class="fl">0.1</span>, <span class="fl">0.4</span>),</a>
|
||||||
|
<a class="sourceLine" id="cb3-7" data-line-number="7"> <span class="dt">replace =</span> <span class="ot">TRUE</span>)</a>
|
||||||
|
<a class="sourceLine" id="cb3-8" data-line-number="8">}</a>
|
||||||
|
<a class="sourceLine" id="cb3-9" data-line-number="9"></a>
|
||||||
|
<a class="sourceLine" id="cb3-10" data-line-number="10">my_TB_data <-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span>(<span class="dt">rifampicin =</span> <span class="kw">sample_rsi</span>(),</a>
|
||||||
|
<a class="sourceLine" id="cb3-11" data-line-number="11"> <span class="dt">isoniazid =</span> <span class="kw">sample_rsi</span>(),</a>
|
||||||
|
<a class="sourceLine" id="cb3-12" data-line-number="12"> <span class="dt">gatifloxacin =</span> <span class="kw">sample_rsi</span>(),</a>
|
||||||
|
<a class="sourceLine" id="cb3-13" data-line-number="13"> <span class="dt">ethambutol =</span> <span class="kw">sample_rsi</span>(),</a>
|
||||||
|
<a class="sourceLine" id="cb3-14" data-line-number="14"> <span class="dt">pyrazinamide =</span> <span class="kw">sample_rsi</span>(),</a>
|
||||||
|
<a class="sourceLine" id="cb3-15" data-line-number="15"> <span class="dt">moxifloxacin =</span> <span class="kw">sample_rsi</span>(),</a>
|
||||||
|
<a class="sourceLine" id="cb3-16" data-line-number="16"> <span class="dt">kanamycin =</span> <span class="kw">sample_rsi</span>())</a></code></pre></div>
|
||||||
<p>Because all column names are automatically verified for valid drug names or codes, this would have worked exactly the same:</p>
|
<p>Because all column names are automatically verified for valid drug names or codes, this would have worked exactly the same:</p>
|
||||||
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" data-line-number="1">my_TB_data <-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span>(<span class="dt">RIF =</span> <span class="kw">sample_rsi</span>(),</a>
|
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" data-line-number="1">my_TB_data <-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span>(<span class="dt">RIF =</span> <span class="kw">sample_rsi</span>(),</a>
|
||||||
<a class="sourceLine" id="cb2-2" data-line-number="2"> <span class="dt">INH =</span> <span class="kw">sample_rsi</span>(),</a>
|
<a class="sourceLine" id="cb4-2" data-line-number="2"> <span class="dt">INH =</span> <span class="kw">sample_rsi</span>(),</a>
|
||||||
<a class="sourceLine" id="cb2-3" data-line-number="3"> <span class="dt">GAT =</span> <span class="kw">sample_rsi</span>(),</a>
|
<a class="sourceLine" id="cb4-3" data-line-number="3"> <span class="dt">GAT =</span> <span class="kw">sample_rsi</span>(),</a>
|
||||||
<a class="sourceLine" id="cb2-4" data-line-number="4"> <span class="dt">ETH =</span> <span class="kw">sample_rsi</span>(),</a>
|
<a class="sourceLine" id="cb4-4" data-line-number="4"> <span class="dt">ETH =</span> <span class="kw">sample_rsi</span>(),</a>
|
||||||
<a class="sourceLine" id="cb2-5" data-line-number="5"> <span class="dt">PZA =</span> <span class="kw">sample_rsi</span>(),</a>
|
<a class="sourceLine" id="cb4-5" data-line-number="5"> <span class="dt">PZA =</span> <span class="kw">sample_rsi</span>(),</a>
|
||||||
<a class="sourceLine" id="cb2-6" data-line-number="6"> <span class="dt">MFX =</span> <span class="kw">sample_rsi</span>(),</a>
|
<a class="sourceLine" id="cb4-6" data-line-number="6"> <span class="dt">MFX =</span> <span class="kw">sample_rsi</span>(),</a>
|
||||||
<a class="sourceLine" id="cb2-7" data-line-number="7"> <span class="dt">KAN =</span> <span class="kw">sample_rsi</span>())</a></code></pre></div>
|
<a class="sourceLine" id="cb4-7" data-line-number="7"> <span class="dt">KAN =</span> <span class="kw">sample_rsi</span>())</a></code></pre></div>
|
||||||
<p>The data set looks like this now:</p>
|
<p>The data set now looks like this:</p>
|
||||||
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/r/utils/head.html">head</a></span>(my_TB_data)</a>
|
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/r/utils/head.html">head</a></span>(my_TB_data)</a>
|
||||||
<a class="sourceLine" id="cb3-2" data-line-number="2"><span class="co"># rifampicin isoniazid gatifloxacin ethambutol pyrazinamide moxifloxacin</span></a>
|
<a class="sourceLine" id="cb5-2" data-line-number="2"><span class="co"># rifampicin isoniazid gatifloxacin ethambutol pyrazinamide moxifloxacin</span></a>
|
||||||
<a class="sourceLine" id="cb3-3" data-line-number="3"><span class="co"># 1 S S R S R S</span></a>
|
<a class="sourceLine" id="cb5-3" data-line-number="3"><span class="co"># 1 S S R R S R</span></a>
|
||||||
<a class="sourceLine" id="cb3-4" data-line-number="4"><span class="co"># 2 S R R S S R</span></a>
|
<a class="sourceLine" id="cb5-4" data-line-number="4"><span class="co"># 2 S R S S R S</span></a>
|
||||||
<a class="sourceLine" id="cb3-5" data-line-number="5"><span class="co"># 3 R R S S R S</span></a>
|
<a class="sourceLine" id="cb5-5" data-line-number="5"><span class="co"># 3 R S R S R R</span></a>
|
||||||
<a class="sourceLine" id="cb3-6" data-line-number="6"><span class="co"># 4 R R R S S S</span></a>
|
<a class="sourceLine" id="cb5-6" data-line-number="6"><span class="co"># 4 S S R S S I</span></a>
|
||||||
<a class="sourceLine" id="cb3-7" data-line-number="7"><span class="co"># 5 R R R R R R</span></a>
|
<a class="sourceLine" id="cb5-7" data-line-number="7"><span class="co"># 5 R R S R S S</span></a>
|
||||||
<a class="sourceLine" id="cb3-8" data-line-number="8"><span class="co"># 6 R R R I S R</span></a>
|
<a class="sourceLine" id="cb5-8" data-line-number="8"><span class="co"># 6 S S R R R S</span></a>
|
||||||
<a class="sourceLine" id="cb3-9" data-line-number="9"><span class="co"># kanamycin</span></a>
|
<a class="sourceLine" id="cb5-9" data-line-number="9"><span class="co"># kanamycin</span></a>
|
||||||
<a class="sourceLine" id="cb3-10" data-line-number="10"><span class="co"># 1 I</span></a>
|
<a class="sourceLine" id="cb5-10" data-line-number="10"><span class="co"># 1 S</span></a>
|
||||||
<a class="sourceLine" id="cb3-11" data-line-number="11"><span class="co"># 2 S</span></a>
|
<a class="sourceLine" id="cb5-11" data-line-number="11"><span class="co"># 2 S</span></a>
|
||||||
<a class="sourceLine" id="cb3-12" data-line-number="12"><span class="co"># 3 R</span></a>
|
<a class="sourceLine" id="cb5-12" data-line-number="12"><span class="co"># 3 R</span></a>
|
||||||
<a class="sourceLine" id="cb3-13" data-line-number="13"><span class="co"># 4 S</span></a>
|
<a class="sourceLine" id="cb5-13" data-line-number="13"><span class="co"># 4 R</span></a>
|
||||||
<a class="sourceLine" id="cb3-14" data-line-number="14"><span class="co"># 5 R</span></a>
|
<a class="sourceLine" id="cb5-14" data-line-number="14"><span class="co"># 5 S</span></a>
|
||||||
<a class="sourceLine" id="cb3-15" data-line-number="15"><span class="co"># 6 S</span></a></code></pre></div>
|
<a class="sourceLine" id="cb5-15" data-line-number="15"><span class="co"># 6 R</span></a></code></pre></div>
|
||||||
<p>We can now add the interpretation of MDR-TB to our data set:</p>
|
<p>We can now add the interpretation of MDR-TB to our data set. You can use:</p>
|
||||||
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" data-line-number="1">my_TB_data<span class="op">$</span>mdr <-<span class="st"> </span><span class="kw"><a href="../reference/mdro.html">mdr_tb</a></span>(my_TB_data)</a>
|
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" data-line-number="1"><span class="kw"><a href="../reference/mdro.html">mdro</a></span>(my_TB_data, <span class="dt">guideline =</span> <span class="st">"TB"</span>)</a></code></pre></div>
|
||||||
<a class="sourceLine" id="cb4-2" data-line-number="2"><span class="co"># </span><span class="al">NOTE</span><span class="co">: No column found as input for `col_mo`, assuming all records contain Mycobacterium tuberculosis.</span></a>
|
<p>or its shortcut <code><a href="../reference/mdro.html">mdr_tb()</a></code>:</p>
|
||||||
<a class="sourceLine" id="cb4-3" data-line-number="3"><span class="co"># Determining multidrug-resistant organisms (MDRO), according to:</span></a>
|
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" data-line-number="1">my_TB_data<span class="op">$</span>mdr <-<span class="st"> </span><span class="kw"><a href="../reference/mdro.html">mdr_tb</a></span>(my_TB_data)</a>
|
||||||
<a class="sourceLine" id="cb4-4" data-line-number="4"><span class="co"># Guideline: Companion handbook to the WHO guidelines for the programmatic management of drug-resistant tuberculosis</span></a>
|
<a class="sourceLine" id="cb7-2" data-line-number="2"><span class="co"># </span><span class="al">NOTE</span><span class="co">: No column found as input for `col_mo`, assuming all records contain Mycobacterium tuberculosis.</span></a>
|
||||||
<a class="sourceLine" id="cb4-5" data-line-number="5"><span class="co"># Version: WHO/HTM/TB/2014.11</span></a>
|
<a class="sourceLine" id="cb7-3" data-line-number="3"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Auto-guessing columns suitable for analysis...OK.</span></a>
|
||||||
<a class="sourceLine" id="cb4-6" data-line-number="6"><span class="co"># Author: WHO (World Health Organization)</span></a>
|
<a class="sourceLine" id="cb7-4" data-line-number="4"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Reliability will be improved if these antimicrobial results would be available too: CAP (capreomycin), RIB (rifabutin), RFP (rifapentine)</span></a>
|
||||||
<a class="sourceLine" id="cb4-7" data-line-number="7"><span class="co"># Source: https://www.who.int/tb/publications/pmdt_companionhandbook/en/</span></a>
|
<a class="sourceLine" id="cb7-5" data-line-number="5"><span class="co"># </span></a>
|
||||||
<a class="sourceLine" id="cb4-8" data-line-number="8"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Auto-guessing columns suitable for analysis...</span></a>
|
<a class="sourceLine" id="cb7-6" data-line-number="6"><span class="co"># Only results with 'R' are considered as resistance. Use `combine_SI = FALSE` to also consider 'I' as resistance.</span></a>
|
||||||
<a class="sourceLine" id="cb4-9" data-line-number="9"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Reliability might be improved if these antimicrobial results would be available too: CAP (capreomycin), RIB (rifabutin), RFP (rifapentine)</span></a></code></pre></div>
|
<a class="sourceLine" id="cb7-7" data-line-number="7"><span class="co"># </span></a>
|
||||||
<p>We also created a package dedicated to data cleaning and checking, called the <code>clean</code> package. It gets automatically installed with the <code>AMR</code> package, so we only have to load it:</p>
|
<a class="sourceLine" id="cb7-8" data-line-number="8"><span class="co"># Determining multidrug-resistant organisms (MDRO), according to:</span></a>
|
||||||
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(clean)</a></code></pre></div>
|
<a class="sourceLine" id="cb7-9" data-line-number="9"><span class="co"># Guideline: Companion handbook to the WHO guidelines for the programmatic management of drug-resistant tuberculosis</span></a>
|
||||||
<p>It contains the <code><a href="https://rdrr.io/pkg/clean/man/freq.html">freq()</a></code> function, to create a frequency table:</p>
|
<a class="sourceLine" id="cb7-10" data-line-number="10"><span class="co"># Version: WHO/HTM/TB/2014.11</span></a>
|
||||||
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/pkg/clean/man/freq.html">freq</a></span>(my_TB_data<span class="op">$</span>mdr)</a></code></pre></div>
|
<a class="sourceLine" id="cb7-11" data-line-number="11"><span class="co"># Author: WHO (World Health Organization)</span></a>
|
||||||
|
<a class="sourceLine" id="cb7-12" data-line-number="12"><span class="co"># Source: https://www.who.int/tb/publications/pmdt_companionhandbook/en/</span></a>
|
||||||
|
<a class="sourceLine" id="cb7-13" data-line-number="13"><span class="co"># </span></a>
|
||||||
|
<a class="sourceLine" id="cb7-14" data-line-number="14"><span class="co"># => Found 4371 MDROs out of 5000 tested isolates (87.4%)</span></a></code></pre></div>
|
||||||
|
<p>Create a frequency table of the results:</p>
|
||||||
|
<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(my_TB_data<span class="op">$</span>mdr)</a></code></pre></div>
|
||||||
<p><strong>Frequency table</strong></p>
|
<p><strong>Frequency table</strong></p>
|
||||||
<p>Class: factor > ordered (numeric)<br>
|
<p>Class: factor > ordered (numeric)<br>
|
||||||
Length: 5,000 (of which NA: 0 = 0%)<br>
|
Length: 5,000 (of which NA: 0 = 0%)<br>
|
||||||
@ -275,46 +356,47 @@ Unique: 5</p>
|
|||||||
<tr class="odd">
|
<tr class="odd">
|
||||||
<td align="left">1</td>
|
<td align="left">1</td>
|
||||||
<td align="left">Mono-resistant</td>
|
<td align="left">Mono-resistant</td>
|
||||||
<td align="right">3276</td>
|
<td align="right">3301</td>
|
||||||
<td align="right">65.52%</td>
|
<td align="right">66.02%</td>
|
||||||
<td align="right">3276</td>
|
<td align="right">3301</td>
|
||||||
<td align="right">65.52%</td>
|
<td align="right">66.02%</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="even">
|
<tr class="even">
|
||||||
<td align="left">2</td>
|
<td align="left">2</td>
|
||||||
<td align="left">Negative</td>
|
<td align="left">Negative</td>
|
||||||
<td align="right">658</td>
|
<td align="right">629</td>
|
||||||
<td align="right">13.16%</td>
|
<td align="right">12.58%</td>
|
||||||
<td align="right">3934</td>
|
<td align="right">3930</td>
|
||||||
<td align="right">78.68%</td>
|
<td align="right">78.60%</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="odd">
|
<tr class="odd">
|
||||||
<td align="left">3</td>
|
<td align="left">3</td>
|
||||||
<td align="left">Multi-drug-resistant</td>
|
<td align="left">Multi-drug-resistant</td>
|
||||||
<td align="right">616</td>
|
<td align="right">596</td>
|
||||||
<td align="right">12.32%</td>
|
<td align="right">11.92%</td>
|
||||||
<td align="right">4550</td>
|
<td align="right">4526</td>
|
||||||
<td align="right">91.00%</td>
|
<td align="right">90.52%</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="even">
|
<tr class="even">
|
||||||
<td align="left">4</td>
|
<td align="left">4</td>
|
||||||
<td align="left">Poly-resistant</td>
|
<td align="left">Poly-resistant</td>
|
||||||
<td align="right">256</td>
|
<td align="right">282</td>
|
||||||
<td align="right">5.12%</td>
|
<td align="right">5.64%</td>
|
||||||
<td align="right">4806</td>
|
<td align="right">4808</td>
|
||||||
<td align="right">96.12%</td>
|
<td align="right">96.16%</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="odd">
|
<tr class="odd">
|
||||||
<td align="left">5</td>
|
<td align="left">5</td>
|
||||||
<td align="left">Extensive drug-resistant</td>
|
<td align="left">Extensively drug-resistant</td>
|
||||||
<td align="right">194</td>
|
<td align="right">192</td>
|
||||||
<td align="right">3.88%</td>
|
<td align="right">3.84%</td>
|
||||||
<td align="right">5000</td>
|
<td align="right">5000</td>
|
||||||
<td align="right">100.00%</td>
|
<td align="right">100.00%</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9021</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -187,7 +187,7 @@
|
|||||||
<h1>How to work with WHONET data</h1>
|
<h1>How to work with WHONET data</h1>
|
||||||
<h4 class="author">Matthijs S. Berends</h4>
|
<h4 class="author">Matthijs S. Berends</h4>
|
||||||
|
|
||||||
<h4 class="date">16 October 2019</h4>
|
<h4 class="date">09 November 2019</h4>
|
||||||
|
|
||||||
|
|
||||||
<div class="hidden name"><code>WHONET.Rmd</code></div>
|
<div class="hidden name"><code>WHONET.Rmd</code></div>
|
||||||
@ -196,18 +196,18 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div id="import-of-data" class="section level1">
|
<div id="import-of-data" class="section level3">
|
||||||
<h1 class="hasAnchor">
|
<h3 class="hasAnchor">
|
||||||
<a href="#import-of-data" class="anchor"></a>Import of data</h1>
|
<a href="#import-of-data" class="anchor"></a>Import of data</h3>
|
||||||
<p>This tutorial assumes you already imported the WHONET data with e.g. the <a href="https://readxl.tidyverse.org/"><code>readxl</code> package</a>. In RStudio, this can be done using the menu button ‘Import Dataset’ in the tab ‘Environment’. Choose the option ‘From Excel’ and select your exported file. Make sure date fields are imported correctly.</p>
|
<p>This tutorial assumes you already imported the WHONET data with e.g. the <a href="https://readxl.tidyverse.org/"><code>readxl</code> package</a>. In RStudio, this can be done using the menu button ‘Import Dataset’ in the tab ‘Environment’. Choose the option ‘From Excel’ and select your exported file. Make sure date fields are imported correctly.</p>
|
||||||
<p>An example syntax could look like this:</p>
|
<p>An example syntax could look like this:</p>
|
||||||
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(readxl)</a>
|
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(readxl)</a>
|
||||||
<a class="sourceLine" id="cb1-2" data-line-number="2">data <-<span class="st"> </span><span class="kw"><a href="https://readxl.tidyverse.org/reference/read_excel.html">read_excel</a></span>(<span class="dt">path =</span> <span class="st">"path/to/your/file.xlsx"</span>)</a></code></pre></div>
|
<a class="sourceLine" id="cb1-2" data-line-number="2">data <-<span class="st"> </span><span class="kw"><a href="https://readxl.tidyverse.org/reference/read_excel.html">read_excel</a></span>(<span class="dt">path =</span> <span class="st">"path/to/your/file.xlsx"</span>)</a></code></pre></div>
|
||||||
<p>This package comes with an <a href="https://msberends.gitlab.io/AMR/reference/WHONET.html">example data set <code>WHONET</code></a>. We will use it for this analysis.</p>
|
<p>This package comes with an <a href="https://msberends.gitlab.io/AMR/reference/WHONET.html">example data set <code>WHONET</code></a>. We will use it for this analysis.</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="preparation" class="section level1">
|
<div id="preparation" class="section level3">
|
||||||
<h1 class="hasAnchor">
|
<h3 class="hasAnchor">
|
||||||
<a href="#preparation" class="anchor"></a>Preparation</h1>
|
<a href="#preparation" class="anchor"></a>Preparation</h3>
|
||||||
<p>First, load the relevant packages if you did not yet did this. I use the tidyverse for all of my analyses. All of them. If you don’t know it yet, I suggest you read about it on their website: <a href="https://www.tidyverse.org/" class="uri">https://www.tidyverse.org/</a>.</p>
|
<p>First, load the relevant packages if you did not yet did this. I use the tidyverse for all of my analyses. All of them. If you don’t know it yet, I suggest you read about it on their website: <a href="https://www.tidyverse.org/" class="uri">https://www.tidyverse.org/</a>.</p>
|
||||||
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(dplyr) <span class="co"># part of tidyverse</span></a>
|
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(dplyr) <span class="co"># part of tidyverse</span></a>
|
||||||
<a class="sourceLine" id="cb2-2" data-line-number="2"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(ggplot2) <span class="co"># part of tidyverse</span></a>
|
<a class="sourceLine" id="cb2-2" data-line-number="2"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(ggplot2) <span class="co"># part of tidyverse</span></a>
|
||||||
@ -224,18 +224,16 @@
|
|||||||
<a class="sourceLine" id="cb3-5" data-line-number="5"><span class="st"> </span><span class="co"># transform everything from "AMP_ND10" to "CIP_EE" to the new `rsi` class</span></a>
|
<a class="sourceLine" id="cb3-5" data-line-number="5"><span class="st"> </span><span class="co"># transform everything from "AMP_ND10" to "CIP_EE" to the new `rsi` class</span></a>
|
||||||
<a class="sourceLine" id="cb3-6" data-line-number="6"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_at</a></span>(<span class="kw"><a href="https://dplyr.tidyverse.org/reference/vars.html">vars</a></span>(AMP_ND10<span class="op">:</span>CIP_EE), as.rsi)</a></code></pre></div>
|
<a class="sourceLine" id="cb3-6" data-line-number="6"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_at</a></span>(<span class="kw"><a href="https://dplyr.tidyverse.org/reference/vars.html">vars</a></span>(AMP_ND10<span class="op">:</span>CIP_EE), as.rsi)</a></code></pre></div>
|
||||||
<p>No errors or warnings, so all values are transformed succesfully.</p>
|
<p>No errors or warnings, so all values are transformed succesfully.</p>
|
||||||
<p>We created a package dedicated to data cleaning and checking, called the <code>clean</code> package. It gets automatically installed with the <code>AMR</code> package, so we only have to load it:</p>
|
<p>We also created a package dedicated to data cleaning and checking, called the <code>cleaner</code> package. It gets automatically installed with the <code>AMR</code> package. For its <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code> function to create frequency tables, you don’t even need to load it yourself as it is available through the <code>AMR</code> package as well.</p>
|
||||||
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(clean)</a></code></pre></div>
|
|
||||||
<p>It contains the <code><a href="https://rdrr.io/pkg/clean/man/freq.html">freq()</a></code> function, to create frequency tables.</p>
|
|
||||||
<p>So let’s check our data, with a couple of frequency tables:</p>
|
<p>So let’s check our data, with a couple of frequency tables:</p>
|
||||||
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" data-line-number="1"><span class="co"># our newly created `mo` variable</span></a>
|
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" data-line-number="1"><span class="co"># our newly created `mo` variable</span></a>
|
||||||
<a class="sourceLine" id="cb5-2" data-line-number="2">data <span class="op">%>%</span><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/clean/man/freq.html">freq</a></span>(mo, <span class="dt">nmax =</span> <span class="dv">10</span>)</a></code></pre></div>
|
<a class="sourceLine" id="cb4-2" data-line-number="2">data <span class="op">%>%</span><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(mo, <span class="dt">nmax =</span> <span class="dv">10</span>)</a></code></pre></div>
|
||||||
<p><strong>Frequency table</strong></p>
|
<p><strong>Frequency table</strong></p>
|
||||||
<p>Class: mo (character)<br>
|
<p>Class: mo (character)<br>
|
||||||
Length: 500 (of which NA: 0 = 0%)<br>
|
Length: 500 (of which NA: 0 = 0%)<br>
|
||||||
Unique: 39</p>
|
Unique: 39</p>
|
||||||
<p>Gram-negative: 281 (56.20%)<br>
|
<p>Gram-negative: 280 (56.00%)<br>
|
||||||
Gram-positive: 219 (43.80%)<br>
|
Gram-positive: 220 (44.00%)<br>
|
||||||
Nr of genera: 17<br>
|
Nr of genera: 17<br>
|
||||||
Nr of species: 39</p>
|
Nr of species: 39</p>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
@ -331,10 +329,10 @@ Nr of species: 39</p>
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<p>(omitted 29 entries, n = 57 [11.40%])</p>
|
<p>(omitted 29 entries, n = 57 [11.40%])</p>
|
||||||
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" data-line-number="1"></a>
|
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" data-line-number="1"></a>
|
||||||
<a class="sourceLine" id="cb6-2" data-line-number="2"><span class="co"># our transformed antibiotic columns</span></a>
|
<a class="sourceLine" id="cb5-2" data-line-number="2"><span class="co"># our transformed antibiotic columns</span></a>
|
||||||
<a class="sourceLine" id="cb6-3" data-line-number="3"><span class="co"># amoxicillin/clavulanic acid (J01CR02) as an example</span></a>
|
<a class="sourceLine" id="cb5-3" data-line-number="3"><span class="co"># amoxicillin/clavulanic acid (J01CR02) as an example</span></a>
|
||||||
<a class="sourceLine" id="cb6-4" data-line-number="4">data <span class="op">%>%</span><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/clean/man/freq.html">freq</a></span>(AMC_ND2)</a></code></pre></div>
|
<a class="sourceLine" id="cb5-4" data-line-number="4">data <span class="op">%>%</span><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(AMC_ND2)</a></code></pre></div>
|
||||||
<p><strong>Frequency table</strong></p>
|
<p><strong>Frequency table</strong></p>
|
||||||
<p>Class: factor > ordered > rsi (numeric)<br>
|
<p>Class: factor > ordered > rsi (numeric)<br>
|
||||||
Length: 500 (of which NA: 19 = 3.8%)<br>
|
Length: 500 (of which NA: 19 = 3.8%)<br>
|
||||||
@ -378,24 +376,17 @@ Unique: 3</p>
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div id="analysis" class="section level1">
|
<div id="a-first-glimpse-at-results" class="section level3">
|
||||||
<h1 class="hasAnchor">
|
<h3 class="hasAnchor">
|
||||||
<a href="#analysis" class="anchor"></a>Analysis</h1>
|
<a href="#a-first-glimpse-at-results" class="anchor"></a>A first glimpse at results</h3>
|
||||||
<p><em>(more will be available soon)</em></p>
|
<p>An easy ggplot will already give a lot of information, using the included <code><a href="../reference/ggplot_rsi.html">ggplot_rsi()</a></code> function:</p>
|
||||||
|
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" data-line-number="1"><span class="kw"><a href="../reference/ggplot_rsi.html">ggplot_rsi</a></span>(data, <span class="dt">translate_ab =</span> <span class="st">'ab'</span>)</a></code></pre></div>
|
||||||
|
<p><img src="WHONET_files/figure-html/unnamed-chunk-5-1.png" width="720"></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
||||||
|
|
||||||
<div id="tocnav">
|
|
||||||
<h2 class="hasAnchor">
|
|
||||||
<a href="#tocnav" class="anchor"></a>Contents</h2>
|
|
||||||
<ul class="nav nav-pills nav-stacked">
|
|
||||||
<li><a href="#import-of-data">Import of data</a></li>
|
|
||||||
<li><a href="#preparation">Preparation</a></li>
|
|
||||||
<li><a href="#analysis">Analysis</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
BIN
docs/articles/WHONET_files/figure-html/unnamed-chunk-5-1.png
Normal file
After Width: | Height: | Size: 209 KiB |
@ -84,7 +84,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9017</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9021</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9017</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9021</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9017</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9021</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -194,7 +194,7 @@
|
|||||||
<p><em>(<help title="Too Long, Didn't Read">TLDR</help> - to find out how to conduct AMR analysis, please <a href="./articles/AMR.html">continue reading here to get started</a>.</em></p>
|
<p><em>(<help title="Too Long, Didn't Read">TLDR</help> - to find out how to conduct AMR analysis, please <a href="./articles/AMR.html">continue reading here to get started</a>.</em></p>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p><em>18 October 2019</em><br><strong>METHODS PAPER PREPRINTED</strong><br>
|
<p><em>18 October 2019</em><br><strong>METHODS PAPER PREPRINTED</strong><br>
|
||||||
A methods paper about this package has been preprinted at bioRxiv. Please see <a href="https://doi.org/10.1101/810622">here for the publishers page</a> or <a href="https://www.biorxiv.org/content/early/2019/10/18/810622.full.pdf">click here for the PDF</a>.</p>
|
A methods paper about this package has been preprinted at bioRxiv. It was updated on 8 November 2019. Please click <a href="https://doi.org/10.1101/810622">here for the publishers page</a>.</p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<hr>
|
<hr>
|
||||||
<div id="what-is-amr-for-r" class="section level3">
|
<div id="what-is-amr-for-r" class="section level3">
|
||||||
|
@ -84,7 +84,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9017</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9021</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -231,11 +231,11 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="amr-0-8-0-9017" class="section level1">
|
<div id="amr-0-8-0-9021" class="section level1">
|
||||||
<h1 class="page-header">
|
<h1 class="page-header">
|
||||||
<a href="#amr-0-8-0-9017" class="anchor"></a>AMR 0.8.0.9017<small> Unreleased </small>
|
<a href="#amr-0-8-0-9021" class="anchor"></a>AMR 0.8.0.9021<small> Unreleased </small>
|
||||||
</h1>
|
</h1>
|
||||||
<p><small>Last updated: 06-Nov-2019</small></p>
|
<p><small>Last updated: 09-Nov-2019</small></p>
|
||||||
<div id="new" class="section level3">
|
<div id="new" class="section level3">
|
||||||
<h3 class="hasAnchor">
|
<h3 class="hasAnchor">
|
||||||
<a href="#new" class="anchor"></a>New</h3>
|
<a href="#new" class="anchor"></a>New</h3>
|
||||||
@ -1333,7 +1333,7 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
|
|||||||
<div id="tocnav">
|
<div id="tocnav">
|
||||||
<h2>Contents</h2>
|
<h2>Contents</h2>
|
||||||
<ul class="nav nav-pills nav-stacked">
|
<ul class="nav nav-pills nav-stacked">
|
||||||
<li><a href="#amr-0-8-0-9017">0.8.0.9017</a></li>
|
<li><a href="#amr-0-8-0-9021">0.8.0.9021</a></li>
|
||||||
<li><a href="#amr-0-8-0">0.8.0</a></li>
|
<li><a href="#amr-0-8-0">0.8.0</a></li>
|
||||||
<li><a href="#amr-0-7-1">0.7.1</a></li>
|
<li><a href="#amr-0-7-1">0.7.1</a></li>
|
||||||
<li><a href="#amr-0-7-0">0.7.0</a></li>
|
<li><a href="#amr-0-7-0">0.7.0</a></li>
|
||||||
|
@ -85,7 +85,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9017</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9021</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9017</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9021</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9017</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9021</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9017</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9021</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9017</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9021</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9017</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9021</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9008</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9021</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ count_R and count_IR can be used to count resistant isolates, count_S and count_
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9017</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9021</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9017</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9021</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9017</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9021</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9017</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9021</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9017</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9021</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9009</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9021</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9017</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9021</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9017</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9021</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9017</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9021</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ portion_R and portion_IR can be used to calculate resistance, portion_S and port
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9017</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9021</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ below to see their documentation.
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9008</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9021</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
2
index.md
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
> *18 October 2019*
|
> *18 October 2019*
|
||||||
> **METHODS PAPER PREPRINTED**
|
> **METHODS PAPER PREPRINTED**
|
||||||
> A methods paper about this package has been preprinted at bioRxiv. Please see [here for the publishers page](https://doi.org/10.1101/810622) or [click here for the PDF](https://www.biorxiv.org/content/early/2019/10/18/810622.full.pdf).
|
> A methods paper about this package has been preprinted at bioRxiv. It was updated on 8 November 2019. Please click [here for the publishers page](https://doi.org/10.1101/810622).
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
|
@ -144,13 +144,9 @@ Now, let's start the cleaning and the analysis!
|
|||||||
|
|
||||||
# Cleaning the data
|
# Cleaning the data
|
||||||
|
|
||||||
We also created a package dedicated to data cleaning and checking, called the `clean` package. It gets automatically installed with the `AMR` package, so we only have to load it:
|
We also created a package dedicated to data cleaning and checking, called the `cleaner` package. It gets automatically installed with the `AMR` package. For its `freq()` function to create frequency tables, you don't even need to load it yourself as it is available through the `AMR` package as well.
|
||||||
|
|
||||||
```{r lib clean, message = FALSE}
|
For example, for the `gender` variable:
|
||||||
library(clean)
|
|
||||||
```
|
|
||||||
|
|
||||||
Use the frequency table function `freq()` from this `clean` package to look specifically for unique values in any variable. For example, for the `gender` variable:
|
|
||||||
|
|
||||||
```{r freq gender 1, eval = FALSE}
|
```{r freq gender 1, eval = FALSE}
|
||||||
data %>% freq(gender) # this would be the same: freq(data$gender)
|
data %>% freq(gender) # this would be the same: freq(data$gender)
|
||||||
@ -210,7 +206,7 @@ data <- data %>%
|
|||||||
mutate(first = first_isolate(.))
|
mutate(first = first_isolate(.))
|
||||||
```
|
```
|
||||||
|
|
||||||
So only `r AMR:::percentage(sum(data$first) / nrow(data))` is suitable for resistance analysis! We can now filter on it with the `filter()` function, also from the `dplyr` package:
|
So only `r cleaner::percentage(sum(data$first) / nrow(data))` is suitable for resistance analysis! We can now filter on it with the `filter()` function, also from the `dplyr` package:
|
||||||
|
|
||||||
```{r 1st isolate filter}
|
```{r 1st isolate filter}
|
||||||
data_1st <- data %>%
|
data_1st <- data %>%
|
||||||
@ -230,7 +226,7 @@ data_1st <- data %>%
|
|||||||
weighted_df <- data %>%
|
weighted_df <- data %>%
|
||||||
filter(bacteria == as.mo("E. coli")) %>%
|
filter(bacteria == as.mo("E. coli")) %>%
|
||||||
# only most prevalent patient
|
# only most prevalent patient
|
||||||
filter(patient_id == top_freq(freq(., patient_id), 1)[1]) %>%
|
filter(patient_id == cleaner::top_freq(freq(., patient_id), 1)[1]) %>%
|
||||||
arrange(date) %>%
|
arrange(date) %>%
|
||||||
select(date, patient_id, bacteria, AMX:GEN, first) %>%
|
select(date, patient_id, bacteria, AMX:GEN, first) %>%
|
||||||
# maximum of 10 rows
|
# maximum of 10 rows
|
||||||
@ -260,7 +256,7 @@ data <- data %>%
|
|||||||
weighted_df2 <- data %>%
|
weighted_df2 <- data %>%
|
||||||
filter(bacteria == as.mo("E. coli")) %>%
|
filter(bacteria == as.mo("E. coli")) %>%
|
||||||
# only most prevalent patient
|
# only most prevalent patient
|
||||||
filter(patient_id == top_freq(freq(., patient_id), 1)[1]) %>%
|
filter(patient_id == cleaner::top_freq(freq(., patient_id), 1)[1]) %>%
|
||||||
arrange(date) %>%
|
arrange(date) %>%
|
||||||
select(date, patient_id, bacteria, AMX:GEN, first, first_weighted) %>%
|
select(date, patient_id, bacteria, AMX:GEN, first, first_weighted) %>%
|
||||||
# maximum of 10 rows
|
# maximum of 10 rows
|
||||||
@ -272,7 +268,7 @@ weighted_df2 %>%
|
|||||||
knitr::kable(align = "c")
|
knitr::kable(align = "c")
|
||||||
```
|
```
|
||||||
|
|
||||||
Instead of `r sum(weighted_df$first)`, now `r sum(weighted_df2$first_weighted)` isolates are flagged. In total, `r AMR:::percentage(sum(data$first_weighted) / nrow(data))` of all isolates are marked 'first weighted' - `r AMR:::percentage((sum(data$first_weighted) / nrow(data)) - (sum(data$first) / nrow(data)))` more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.
|
Instead of `r sum(weighted_df$first)`, now `r sum(weighted_df2$first_weighted)` isolates are flagged. In total, `r cleaner::percentage(sum(data$first_weighted) / nrow(data))` of all isolates are marked 'first weighted' - `r cleaner::percentage((sum(data$first_weighted) / nrow(data)) - (sum(data$first) / nrow(data)))` more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.
|
||||||
|
|
||||||
As with `filter_first_isolate()`, there's a shortcut for this new algorithm too:
|
As with `filter_first_isolate()`, there's a shortcut for this new algorithm too:
|
||||||
```{r 1st isolate filter 3, results = 'hide', message = FALSE, warning = FALSE}
|
```{r 1st isolate filter 3, results = 'hide', message = FALSE, warning = FALSE}
|
||||||
|
@ -21,6 +21,7 @@ knitr::opts_chunk$set(
|
|||||||
fig.width = 7.5,
|
fig.width = 7.5,
|
||||||
fig.height = 4.5
|
fig.height = 4.5
|
||||||
)
|
)
|
||||||
|
library(AMR)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
@ -31,12 +32,17 @@ What are EUCAST rules? The European Committee on Antimicrobial Susceptibility Te
|
|||||||
|
|
||||||
In Europe, a lot of medical microbiological laboratories already apply these rules ([Brown *et al.*, 2015](https://www.eurosurveillance.org/content/10.2807/1560-7917.ES2015.20.2.21008)). Our package features their latest insights on intrinsic resistance and exceptional phenotypes (version 9.0, 2019). Moreover, the `eucast_rules()` function we use for this purpose can also apply additional rules, like forcing <help title="ATC: J01CA01">ampicillin</help> = R in isolates when <help title="ATC: J01CR02">amoxicillin/clavulanic acid</help> = R.
|
In Europe, a lot of medical microbiological laboratories already apply these rules ([Brown *et al.*, 2015](https://www.eurosurveillance.org/content/10.2807/1560-7917.ES2015.20.2.21008)). Our package features their latest insights on intrinsic resistance and exceptional phenotypes (version 9.0, 2019). Moreover, the `eucast_rules()` function we use for this purpose can also apply additional rules, like forcing <help title="ATC: J01CA01">ampicillin</help> = R in isolates when <help title="ATC: J01CR02">amoxicillin/clavulanic acid</help> = R.
|
||||||
|
|
||||||
*(more will be available soon)*
|
|
||||||
|
|
||||||
### Benefit for empiric therapy success estimation
|
|
||||||
|
|
||||||
*(will be available soon)*
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
*(will be available soon)*
|
These rules can be used to discard impossible bug-drug combinations in your data. For example, *Klebsiella* produces beta-lactamase that prevents ampicillin (or amoxicillin) from working against it. In other words, every strain of *Klebsiella* is resistant to ampicillin.
|
||||||
|
|
||||||
|
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, *Klebsiella*). EUCAST expert rules solves this:
|
||||||
|
|
||||||
|
```{r, warning = FALSE, message = FALSE}
|
||||||
|
oops <- data.frame(mo = c("Klebsiella",
|
||||||
|
"Escherichia"),
|
||||||
|
ampicillin = "S")
|
||||||
|
oops
|
||||||
|
|
||||||
|
eucast_rules(oops, info = FALSE)
|
||||||
|
```
|
||||||
|
@ -21,13 +21,54 @@ knitr::opts_chunk$set(
|
|||||||
library(AMR)
|
library(AMR)
|
||||||
```
|
```
|
||||||
|
|
||||||
With the function `mdro()`, you can determine multi-drug resistant organisms (MDRO). It currently support these guidelines:
|
With the function `mdro()`, you can determine multi-drug resistant organisms (MDRO).
|
||||||
|
|
||||||
* "Intrinsic Resistance and Exceptional Phenotypes Tables", by EUCAST (European Committee on Antimicrobial Susceptibility Testing)
|
#### Type of input
|
||||||
* "Companion handbook to the WHO guidelines for the programmatic management of drug-resistant tuberculosis", by WHO (World Health Organization)
|
|
||||||
* "WIP-Richtlijn Bijzonder Resistente Micro-organismen (BRMO)", by RIVM (Rijksinstituut voor de Volksgezondheid, the Netherlands National Institute for Public Health and the Environment)
|
|
||||||
|
|
||||||
As an example, I will make a data set to determine multi-drug resistant TB:
|
The `mdro()` takes a data set as input, such as a regular `data.frame`. It automatically determines the right columns for info about your isolates, like 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 `?mdro`.
|
||||||
|
|
||||||
|
For WHONET data (and most other data), all settings are automatically set correctly.
|
||||||
|
|
||||||
|
#### Guidelines
|
||||||
|
|
||||||
|
The function support multiple guidelines. You can select a guideline with the `guideline` parameter. Currently supported guidelines are (case-insensitive):
|
||||||
|
|
||||||
|
* `guideline = "CMI2012"` (default)
|
||||||
|
|
||||||
|
Magiorakos AP, Srinivasan A *et al.* "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) ([link](https://www.clinicalmicrobiologyandinfection.com/article/S1198-743X(14)61632-3/fulltext))
|
||||||
|
* `guideline = "EUCAST"`
|
||||||
|
|
||||||
|
The European international guideline - EUCAST Expert Rules Version 3.1 "Intrinsic Resistance and Exceptional Phenotypes Tables" ([link](http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf))
|
||||||
|
* `guideline = "TB"`
|
||||||
|
|
||||||
|
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" ([link](https://www.who.int/tb/publications/pmdt_companionhandbook/en/))
|
||||||
|
* `guideline = "MRGN"`
|
||||||
|
|
||||||
|
The German national guideline - Mueller et al. (2015) Antimicrobial Resistance and Infection Control 4:7. ([link](https://doi.org/10.1186/s13756-015-0047-6))
|
||||||
|
* `guideline = "BRMO"`
|
||||||
|
|
||||||
|
The Dutch national guideline - Rijksinstituut voor Volksgezondheid en Milieu "WIP-richtlijn BRMO (Bijzonder Resistente Micro-Organismen) [ZKH]" ([link](https://www.rivm.nl/Documenten_en_publicaties/Professioneel_Praktisch/Richtlijnen/Infectieziekten/WIP_Richtlijnen/WIP_Richtlijnen/Ziekenhuizen/WIP_richtlijn_BRMO_Bijzonder_Resistente_Micro_Organismen_ZKH))
|
||||||
|
|
||||||
|
#### Examples
|
||||||
|
|
||||||
|
The `mdro()` function always returns an ordered `factor`. For example, the output of the default guideline by Magiorakos *et al.* returns a `factor` with levels 'Negative', 'MDR', 'XDR' or 'PDR' in that order. If we test that guideline on the included `example_isolates` data set, we get:
|
||||||
|
|
||||||
|
```{r, message = FALSE}
|
||||||
|
library(dplyr) # to support pipes: %>%
|
||||||
|
```
|
||||||
|
```{r, results = 'hide'}
|
||||||
|
example_isolates %>%
|
||||||
|
mdro() %>%
|
||||||
|
freq() # show frequency table of the result
|
||||||
|
```
|
||||||
|
```{r, echo = FALSE, results = 'asis', message = FALSE, warning = FALSE}
|
||||||
|
library(dplyr) # to support pipes: %>%
|
||||||
|
example_isolates %>%
|
||||||
|
mdro(info = FALSE) %>%
|
||||||
|
freq() # show frequency table of the result
|
||||||
|
```
|
||||||
|
|
||||||
|
For another example, I will create a data set to determine multi-drug resistant TB:
|
||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
# a helper function to get a random vector with values S, I and R
|
# a helper function to get a random vector with values S, I and R
|
||||||
@ -60,25 +101,25 @@ my_TB_data <- data.frame(RIF = sample_rsi(),
|
|||||||
KAN = sample_rsi())
|
KAN = sample_rsi())
|
||||||
```
|
```
|
||||||
|
|
||||||
The data set looks like this now:
|
The data set now looks like this:
|
||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
head(my_TB_data)
|
head(my_TB_data)
|
||||||
```
|
```
|
||||||
|
|
||||||
We can now add the interpretation of MDR-TB to our data set:
|
We can now add the interpretation of MDR-TB to our data set. You can use:
|
||||||
|
|
||||||
|
```r
|
||||||
|
mdro(my_TB_data, guideline = "TB")
|
||||||
|
```
|
||||||
|
|
||||||
|
or its shortcut `mdr_tb()`:
|
||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
my_TB_data$mdr <- mdr_tb(my_TB_data)
|
my_TB_data$mdr <- mdr_tb(my_TB_data)
|
||||||
```
|
```
|
||||||
|
|
||||||
We also created a package dedicated to data cleaning and checking, called the `clean` package. It gets automatically installed with the `AMR` package, so we only have to load it:
|
Create a frequency table of the results:
|
||||||
|
|
||||||
```{r lib clean, message = FALSE}
|
|
||||||
library(clean)
|
|
||||||
```
|
|
||||||
|
|
||||||
It contains the `freq()` function, to create a frequency table:
|
|
||||||
|
|
||||||
```{r, results = 'asis'}
|
```{r, results = 'asis'}
|
||||||
freq(my_TB_data$mdr)
|
freq(my_TB_data$mdr)
|
||||||
|
@ -23,7 +23,7 @@ knitr::opts_chunk$set(
|
|||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
# Import of data
|
### Import of data
|
||||||
|
|
||||||
This tutorial assumes you already imported the WHONET data with e.g. the [`readxl` package](https://readxl.tidyverse.org/). In RStudio, this can be done using the menu button 'Import Dataset' in the tab 'Environment'. Choose the option 'From Excel' and select your exported file. Make sure date fields are imported correctly.
|
This tutorial assumes you already imported the WHONET data with e.g. the [`readxl` package](https://readxl.tidyverse.org/). In RStudio, this can be done using the menu button 'Import Dataset' in the tab 'Environment'. Choose the option 'From Excel' and select your exported file. Make sure date fields are imported correctly.
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ data <- read_excel(path = "path/to/your/file.xlsx")
|
|||||||
|
|
||||||
This package comes with an [example data set `WHONET`](https://msberends.gitlab.io/AMR/reference/WHONET.html). We will use it for this analysis.
|
This package comes with an [example data set `WHONET`](https://msberends.gitlab.io/AMR/reference/WHONET.html). We will use it for this analysis.
|
||||||
|
|
||||||
# Preparation
|
### Preparation
|
||||||
|
|
||||||
First, load the relevant packages if you did not yet did this. I use the tidyverse for all of my analyses. All of them. If you don't know it yet, I suggest you read about it on their website: https://www.tidyverse.org/.
|
First, load the relevant packages if you did not yet did this. I use the tidyverse for all of my analyses. All of them. If you don't know it yet, I suggest you read about it on their website: https://www.tidyverse.org/.
|
||||||
|
|
||||||
@ -62,13 +62,7 @@ data <- WHONET %>%
|
|||||||
|
|
||||||
No errors or warnings, so all values are transformed succesfully.
|
No errors or warnings, so all values are transformed succesfully.
|
||||||
|
|
||||||
We created a package dedicated to data cleaning and checking, called the `clean` package. It gets automatically installed with the `AMR` package, so we only have to load it:
|
We also created a package dedicated to data cleaning and checking, called the `cleaner` package. It gets automatically installed with the `AMR` package. For its `freq()` function to create frequency tables, you don't even need to load it yourself as it is available through the `AMR` package as well.
|
||||||
|
|
||||||
```{r lib clean, message = FALSE}
|
|
||||||
library(clean)
|
|
||||||
```
|
|
||||||
|
|
||||||
It contains the `freq()` function, to create frequency tables.
|
|
||||||
|
|
||||||
So let's check our data, with a couple of frequency tables:
|
So let's check our data, with a couple of frequency tables:
|
||||||
|
|
||||||
@ -81,7 +75,10 @@ data %>% freq(mo, nmax = 10)
|
|||||||
data %>% freq(AMC_ND2)
|
data %>% freq(AMC_ND2)
|
||||||
```
|
```
|
||||||
|
|
||||||
# Analysis
|
### A first glimpse at results
|
||||||
|
|
||||||
*(more will be available soon)*
|
An easy ggplot will already give a lot of information, using the included `ggplot_rsi()` function:
|
||||||
|
|
||||||
|
```{r}
|
||||||
|
ggplot_rsi(data, translate_ab = 'ab')
|
||||||
|
```
|
||||||
|