(v1.3.0.9001) website update
|
@ -1,5 +1,5 @@
|
|||
Package: AMR
|
||||
Version: 1.3.0.9000
|
||||
Version: 1.3.0.9001
|
||||
Date: 2020-08-10
|
||||
Title: Antimicrobial Resistance Analysis
|
||||
Authors@R: c(
|
||||
|
|
2
NEWS.md
|
@ -1,4 +1,4 @@
|
|||
# AMR 1.3.0.9000
|
||||
# AMR 1.3.0.9001
|
||||
## <small>Last updated: 10 August 2020</small>
|
||||
|
||||
### Changed
|
||||
|
|
2
R/rsi.R
|
@ -110,7 +110,7 @@
|
|||
#' library(dplyr)
|
||||
#' df %>% mutate_at(vars(AMP:TOB), as.rsi)
|
||||
#' df %>% mutate(across(AMP:TOB), as.rsi)
|
||||
|
||||
#'
|
||||
#' df %>%
|
||||
#' mutate_at(vars(AMP:TOB), as.rsi, mo = "E. coli")
|
||||
#'
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="https://msberends.github.io/AMR/index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9000</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9001</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -248,7 +248,7 @@ Content not found. Please use links in the navbar.
|
|||
</div>
|
||||
|
||||
<div class="pkgdown">
|
||||
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.1.</p>
|
||||
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.1.9000.</p>
|
||||
</div>
|
||||
|
||||
</footer>
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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">1.3.0.9000</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9001</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -496,7 +496,7 @@ END OF TERMS AND CONDITIONS
|
|||
</div>
|
||||
|
||||
<div class="pkgdown">
|
||||
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.1.</p>
|
||||
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.1.9000.</p>
|
||||
</div>
|
||||
|
||||
</footer>
|
||||
|
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 64 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 |
|
@ -39,7 +39,7 @@
|
|||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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">1.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9001</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -186,7 +186,7 @@
|
|||
<h1 data-toc-skip>How to apply EUCAST rules</h1>
|
||||
<h4 class="author">Matthijs S. Berends</h4>
|
||||
|
||||
<h4 class="date">30 July 2020</h4>
|
||||
<h4 class="date">10 August 2020</h4>
|
||||
|
||||
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/master/vignettes/EUCAST.Rmd"><code>vignettes/EUCAST.Rmd</code></a></small>
|
||||
<div class="hidden name"><code>EUCAST.Rmd</code></div>
|
||||
|
@ -209,33 +209,39 @@
|
|||
<a href="#examples" class="anchor"></a>Examples</h2>
|
||||
<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><a href="../reference/eucast_rules.html">eucast_rules()</a></code>:</p>
|
||||
<div class="sourceCode" id="cb1"><html><body><pre class="r"><span class="no">oops</span> <span class="kw"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span>(<span class="kw">mo</span> <span class="kw">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"Klebsiella"</span>,
|
||||
<div class="sourceCode" id="cb1"><pre class="downlit">
|
||||
<span class="kw">oops</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span>(mo = <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"Klebsiella"</span>,
|
||||
<span class="st">"Escherichia"</span>),
|
||||
<span class="kw">ampicillin</span> <span class="kw">=</span> <span class="st">"S"</span>)
|
||||
<span class="no">oops</span>
|
||||
ampicillin = <span class="st">"S"</span>)
|
||||
<span class="kw">oops</span>
|
||||
<span class="co"># mo ampicillin</span>
|
||||
<span class="co"># 1 Klebsiella S</span>
|
||||
<span class="co"># 2 Escherichia S</span>
|
||||
|
||||
<span class="fu"><a href="../reference/eucast_rules.html">eucast_rules</a></span>(<span class="no">oops</span>, <span class="kw">info</span> <span class="kw">=</span> <span class="fl">FALSE</span>)
|
||||
<span class="fu"><a href="../reference/eucast_rules.html">eucast_rules</a></span>(<span class="kw">oops</span>, info = <span class="fl">FALSE</span>)
|
||||
<span class="co"># mo ampicillin</span>
|
||||
<span class="co"># 1 Klebsiella R</span>
|
||||
<span class="co"># 2 Escherichia S</span></pre></body></html></div>
|
||||
<span class="co"># 2 Escherichia S</span>
|
||||
</pre></div>
|
||||
<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> and is part of the <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> function as well:</p>
|
||||
<div class="sourceCode" id="cb2"><html><body><pre class="r"><span class="no">data</span> <span class="kw"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span>(<span class="kw">mo</span> <span class="kw">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"Staphylococcus aureus"</span>,
|
||||
<div class="sourceCode" id="cb2"><pre class="downlit">
|
||||
<span class="kw">data</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span>(mo = <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"Staphylococcus aureus"</span>,
|
||||
<span class="st">"Enterococcus faecalis"</span>,
|
||||
<span class="st">"Escherichia coli"</span>,
|
||||
<span class="st">"Klebsiella pneumoniae"</span>,
|
||||
<span class="st">"Pseudomonas aeruginosa"</span>),
|
||||
<span class="kw">VAN</span> <span class="kw">=</span> <span class="st">"-"</span>, <span class="co"># Vancomycin</span>
|
||||
<span class="kw">AMX</span> <span class="kw">=</span> <span class="st">"-"</span>, <span class="co"># Amoxicillin</span>
|
||||
<span class="kw">COL</span> <span class="kw">=</span> <span class="st">"-"</span>, <span class="co"># Colistin</span>
|
||||
<span class="kw">CAZ</span> <span class="kw">=</span> <span class="st">"-"</span>, <span class="co"># Ceftazidime</span>
|
||||
<span class="kw">CXM</span> <span class="kw">=</span> <span class="st">"-"</span>, <span class="co"># Cefuroxime</span>
|
||||
<span class="kw">PEN</span> <span class="kw">=</span> <span class="st">"S"</span>, <span class="co"># Penicillin G</span>
|
||||
<span class="kw">FOX</span> <span class="kw">=</span> <span class="st">"S"</span>, <span class="co"># Cefoxitin</span>
|
||||
<span class="kw">stringsAsFactors</span> <span class="kw">=</span> <span class="fl">FALSE</span>)</pre></body></html></div>
|
||||
<div class="sourceCode" id="cb3"><html><body><pre class="r"><span class="no">data</span></pre></body></html></div>
|
||||
VAN = <span class="st">"-"</span>, <span class="co"># Vancomycin</span>
|
||||
AMX = <span class="st">"-"</span>, <span class="co"># Amoxicillin</span>
|
||||
COL = <span class="st">"-"</span>, <span class="co"># Colistin</span>
|
||||
CAZ = <span class="st">"-"</span>, <span class="co"># Ceftazidime</span>
|
||||
CXM = <span class="st">"-"</span>, <span class="co"># Cefuroxime</span>
|
||||
PEN = <span class="st">"S"</span>, <span class="co"># Penicillin G</span>
|
||||
FOX = <span class="st">"S"</span>, <span class="co"># Cefoxitin</span>
|
||||
stringsAsFactors = <span class="fl">FALSE</span>)
|
||||
</pre></div>
|
||||
<div class="sourceCode" id="cb3"><pre class="downlit">
|
||||
<span class="kw">data</span>
|
||||
</pre></div>
|
||||
<table class="table">
|
||||
<thead><tr class="header">
|
||||
<th align="left">mo</th>
|
||||
|
@ -300,7 +306,9 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="sourceCode" id="cb4"><html><body><pre class="r"><span class="fu"><a href="../reference/eucast_rules.html">eucast_rules</a></span>(<span class="no">data</span>)</pre></body></html></div>
|
||||
<div class="sourceCode" id="cb4"><pre class="downlit">
|
||||
<span class="fu"><a href="../reference/eucast_rules.html">eucast_rules</a></span>(<span class="kw">data</span>)
|
||||
</pre></div>
|
||||
<pre><code># Warning: Not all columns with antimicrobial results are of class <rsi>.
|
||||
# Transform eligible columns to class <rsi> on beforehand: your_data %>% mutate_if(is.rsi.eligible, as.rsi)</code></pre>
|
||||
<table class="table">
|
||||
|
@ -385,7 +393,7 @@
|
|||
</div>
|
||||
|
||||
<div class="pkgdown">
|
||||
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.1.</p>
|
||||
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.1.9000.</p>
|
||||
</div>
|
||||
|
||||
</footer>
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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">1.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9001</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -186,7 +186,7 @@
|
|||
<h1 data-toc-skip>How to determine multi-drug resistance (MDR)</h1>
|
||||
<h4 class="author">Matthijs S. Berends</h4>
|
||||
|
||||
<h4 class="date">30 July 2020</h4>
|
||||
<h4 class="date">10 August 2020</h4>
|
||||
|
||||
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/master/vignettes/MDR.Rmd"><code>vignettes/MDR.Rmd</code></a></small>
|
||||
<div class="hidden name"><code>MDR.Rmd</code></div>
|
||||
|
@ -234,16 +234,20 @@
|
|||
<a href="#examples" class="anchor"></a>Examples</h4>
|
||||
<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.</p>
|
||||
<p>The next example uses the <code>example_isolates</code> data set. This is a data set included with this package and contains 2,000 microbial isolates with their full antibiograms. It reflects reality and can be used to practice AMR analysis. If we test the MDR/XDR/PDR guideline on this data set, we get:</p>
|
||||
<div class="sourceCode" id="cb1"><html><body><pre class="r"><span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="no">dplyr</span>) <span class="co"># to support pipes: %>%</span>
|
||||
<span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="no">cleaner</span>) <span class="co"># to create frequency tables</span></pre></body></html></div>
|
||||
<div class="sourceCode" id="cb2"><html><body><pre class="r"><span class="no">example_isolates</span> <span class="kw">%>%</span>
|
||||
<span class="fu"><a href="../reference/mdro.html">mdro</a></span>() <span class="kw">%>%</span>
|
||||
<div class="sourceCode" id="cb1"><pre class="downlit">
|
||||
<span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="kw"><a href="https://dplyr.tidyverse.org">dplyr</a></span>) <span class="co"># to support pipes: %>%</span>
|
||||
<span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="kw"><a href="https://github.com/msberends/cleaner">cleaner</a></span>) <span class="co"># to create frequency tables</span>
|
||||
</pre></div>
|
||||
<div class="sourceCode" id="cb2"><pre class="downlit">
|
||||
<span class="kw">example_isolates</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="../reference/mdro.html">mdro</a></span>() <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>() <span class="co"># show frequency table of the result</span>
|
||||
<span class="co"># NOTE: Using column `mo` as input for `col_mo`.</span>
|
||||
<span class="co"># NOTE: Auto-guessing columns suitable for analysis...OK.</span>
|
||||
<span class="co"># NOTE: Reliability would be improved if these antimicrobial results would be available too: ceftaroline (CPT), fusidic acid (FUS), telavancin (TLV), daptomycin (DAP), quinupristin/dalfopristin (QDA), minocycline (MNO), gentamicin-high (GEH), streptomycin-high (STH), doripenem (DOR), levofloxacin (LVX), netilmicin (NET), ticarcillin/clavulanic acid (TCC), ertapenem (ETP), cefotetan (CTT), aztreonam (ATM), ampicillin/sulbactam (SAM), polymyxin B (PLB)</span>
|
||||
<span class="co"># Warning in mdro(.): NA introduced for isolates where the available percentage of</span>
|
||||
<span class="co"># antimicrobial classes was below 50% (set with `pct_required_classes`)</span></pre></body></html></div>
|
||||
<span class="co"># antimicrobial classes was below 50% (set with `pct_required_classes`)</span>
|
||||
</pre></div>
|
||||
<p><strong>Frequency table</strong></p>
|
||||
<p>Class: factor > ordered (numeric)<br>
|
||||
Length: 2,000<br>
|
||||
|
@ -279,55 +283,67 @@ Unique: 2</p>
|
|||
</tbody>
|
||||
</table>
|
||||
<p>For another example, I will create a data set to determine multi-drug resistant TB:</p>
|
||||
<div class="sourceCode" id="cb3"><html><body><pre class="r"><span class="co"># a helper function to get a random vector with values S, I and R</span>
|
||||
<div class="sourceCode" id="cb3"><pre class="downlit">
|
||||
<span class="co"># a helper function to get a random vector with values S, I and R</span>
|
||||
<span class="co"># with the probabilities 50% - 10% - 40%</span>
|
||||
<span class="no">sample_rsi</span> <span class="kw"><-</span> <span class="kw">function</span>() {
|
||||
<span class="kw">sample_rsi</span> <span class="op"><-</span> <span class="fu">function</span>() {
|
||||
<span class="fu"><a href="https://rdrr.io/r/base/sample.html">sample</a></span>(<span class="fu"><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>),
|
||||
<span class="kw">size</span> <span class="kw">=</span> <span class="fl">5000</span>,
|
||||
<span class="kw">prob</span> <span class="kw">=</span> <span class="fu"><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>),
|
||||
<span class="kw">replace</span> <span class="kw">=</span> <span class="fl">TRUE</span>)
|
||||
size = <span class="fl">5000</span>,
|
||||
prob = <span class="fu"><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>),
|
||||
replace = <span class="fl">TRUE</span>)
|
||||
}
|
||||
|
||||
<span class="no">my_TB_data</span> <span class="kw"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span>(<span class="kw">rifampicin</span> <span class="kw">=</span> <span class="fu">sample_rsi</span>(),
|
||||
<span class="kw">isoniazid</span> <span class="kw">=</span> <span class="fu">sample_rsi</span>(),
|
||||
<span class="kw">gatifloxacin</span> <span class="kw">=</span> <span class="fu">sample_rsi</span>(),
|
||||
<span class="kw">ethambutol</span> <span class="kw">=</span> <span class="fu">sample_rsi</span>(),
|
||||
<span class="kw">pyrazinamide</span> <span class="kw">=</span> <span class="fu">sample_rsi</span>(),
|
||||
<span class="kw">moxifloxacin</span> <span class="kw">=</span> <span class="fu">sample_rsi</span>(),
|
||||
<span class="kw">kanamycin</span> <span class="kw">=</span> <span class="fu">sample_rsi</span>())</pre></body></html></div>
|
||||
<span class="kw">my_TB_data</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span>(rifampicin = <span class="fu">sample_rsi</span>(),
|
||||
isoniazid = <span class="fu">sample_rsi</span>(),
|
||||
gatifloxacin = <span class="fu">sample_rsi</span>(),
|
||||
ethambutol = <span class="fu">sample_rsi</span>(),
|
||||
pyrazinamide = <span class="fu">sample_rsi</span>(),
|
||||
moxifloxacin = <span class="fu">sample_rsi</span>(),
|
||||
kanamycin = <span class="fu">sample_rsi</span>())
|
||||
</pre></div>
|
||||
<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="cb4"><html><body><pre class="r"><span class="no">my_TB_data</span> <span class="kw"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span>(<span class="kw">RIF</span> <span class="kw">=</span> <span class="fu">sample_rsi</span>(),
|
||||
<span class="kw">INH</span> <span class="kw">=</span> <span class="fu">sample_rsi</span>(),
|
||||
<span class="kw">GAT</span> <span class="kw">=</span> <span class="fu">sample_rsi</span>(),
|
||||
<span class="kw">ETH</span> <span class="kw">=</span> <span class="fu">sample_rsi</span>(),
|
||||
<span class="kw">PZA</span> <span class="kw">=</span> <span class="fu">sample_rsi</span>(),
|
||||
<span class="kw">MFX</span> <span class="kw">=</span> <span class="fu">sample_rsi</span>(),
|
||||
<span class="kw">KAN</span> <span class="kw">=</span> <span class="fu">sample_rsi</span>())</pre></body></html></div>
|
||||
<div class="sourceCode" id="cb4"><pre class="downlit">
|
||||
<span class="kw">my_TB_data</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span>(RIF = <span class="fu">sample_rsi</span>(),
|
||||
INH = <span class="fu">sample_rsi</span>(),
|
||||
GAT = <span class="fu">sample_rsi</span>(),
|
||||
ETH = <span class="fu">sample_rsi</span>(),
|
||||
PZA = <span class="fu">sample_rsi</span>(),
|
||||
MFX = <span class="fu">sample_rsi</span>(),
|
||||
KAN = <span class="fu">sample_rsi</span>())
|
||||
</pre></div>
|
||||
<p>The data set now looks like this:</p>
|
||||
<div class="sourceCode" id="cb5"><html><body><pre class="r"><span class="fu"><a href="https://rdrr.io/r/utils/head.html">head</a></span>(<span class="no">my_TB_data</span>)
|
||||
<div class="sourceCode" id="cb5"><pre class="downlit">
|
||||
<span class="fu"><a href="https://rdrr.io/r/utils/head.html">head</a></span>(<span class="kw">my_TB_data</span>)
|
||||
<span class="co"># rifampicin isoniazid gatifloxacin ethambutol pyrazinamide moxifloxacin</span>
|
||||
<span class="co"># 1 S S R R S I</span>
|
||||
<span class="co"># 2 R S R R R S</span>
|
||||
<span class="co"># 3 R S S S I S</span>
|
||||
<span class="co"># 4 S S I S R S</span>
|
||||
<span class="co"># 5 R I R S R S</span>
|
||||
<span class="co"># 6 S S S S R R</span>
|
||||
<span class="co"># 1 R R R R I I</span>
|
||||
<span class="co"># 2 S S S R S R</span>
|
||||
<span class="co"># 3 S I S S S S</span>
|
||||
<span class="co"># 4 S I S R R R</span>
|
||||
<span class="co"># 5 S S R S S R</span>
|
||||
<span class="co"># 6 S R S R R R</span>
|
||||
<span class="co"># kanamycin</span>
|
||||
<span class="co"># 1 I</span>
|
||||
<span class="co"># 2 I</span>
|
||||
<span class="co"># 1 S</span>
|
||||
<span class="co"># 2 R</span>
|
||||
<span class="co"># 3 S</span>
|
||||
<span class="co"># 4 R</span>
|
||||
<span class="co"># 5 R</span>
|
||||
<span class="co"># 6 S</span></pre></body></html></div>
|
||||
<span class="co"># 4 S</span>
|
||||
<span class="co"># 5 S</span>
|
||||
<span class="co"># 6 R</span>
|
||||
</pre></div>
|
||||
<p>We can now add the interpretation of MDR-TB to our data set. You can use:</p>
|
||||
<div class="sourceCode" id="cb6"><html><body><pre class="r"><span class="fu"><a href="../reference/mdro.html">mdro</a></span>(<span class="no">my_TB_data</span>, <span class="kw">guideline</span> <span class="kw">=</span> <span class="st">"TB"</span>)</pre></body></html></div>
|
||||
<div class="sourceCode" id="cb6"><pre class="downlit">
|
||||
<span class="fu"><a href="../reference/mdro.html">mdro</a></span>(<span class="kw">my_TB_data</span>, guideline = <span class="st">"TB"</span>)
|
||||
</pre></div>
|
||||
<p>or its shortcut <code><a href="../reference/mdro.html">mdr_tb()</a></code>:</p>
|
||||
<div class="sourceCode" id="cb7"><html><body><pre class="r"><span class="no">my_TB_data</span>$<span class="no">mdr</span> <span class="kw"><-</span> <span class="fu"><a href="../reference/mdro.html">mdr_tb</a></span>(<span class="no">my_TB_data</span>)
|
||||
<div class="sourceCode" id="cb7"><pre class="downlit">
|
||||
<span class="kw">my_TB_data</span><span class="op">$</span><span class="kw">mdr</span> <span class="op"><-</span> <span class="fu"><a href="../reference/mdro.html">mdr_tb</a></span>(<span class="kw">my_TB_data</span>)
|
||||
<span class="co"># NOTE: No column found as input for `col_mo`, assuming all records contain Mycobacterium tuberculosis.</span>
|
||||
<span class="co"># NOTE: Auto-guessing columns suitable for analysis...OK.</span>
|
||||
<span class="co"># NOTE: Reliability would be improved if these antimicrobial results would be available too: capreomycin (CAP), rifabutin (RIB), rifapentine (RFP)</span></pre></body></html></div>
|
||||
<span class="co"># NOTE: Reliability would be improved if these antimicrobial results would be available too: capreomycin (CAP), rifabutin (RIB), rifapentine (RFP)</span>
|
||||
</pre></div>
|
||||
<p>Create a frequency table of the results:</p>
|
||||
<div class="sourceCode" id="cb8"><html><body><pre class="r"><span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="no">my_TB_data</span>$<span class="no">mdr</span>)</pre></body></html></div>
|
||||
<div class="sourceCode" id="cb8"><pre class="downlit">
|
||||
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="kw">my_TB_data</span><span class="op">$</span><span class="kw">mdr</span>)
|
||||
</pre></div>
|
||||
<p><strong>Frequency table</strong></p>
|
||||
<p>Class: factor > ordered (numeric)<br>
|
||||
Length: 5,000<br>
|
||||
|
@ -347,40 +363,40 @@ Unique: 5</p>
|
|||
<tr class="odd">
|
||||
<td align="left">1</td>
|
||||
<td align="left">Mono-resistant</td>
|
||||
<td align="right">3215</td>
|
||||
<td align="right">64.30%</td>
|
||||
<td align="right">3215</td>
|
||||
<td align="right">64.30%</td>
|
||||
<td align="right">3229</td>
|
||||
<td align="right">64.58%</td>
|
||||
<td align="right">3229</td>
|
||||
<td align="right">64.58%</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">2</td>
|
||||
<td align="left">Multi-drug-resistant</td>
|
||||
<td align="right">643</td>
|
||||
<td align="right">12.86%</td>
|
||||
<td align="right">3858</td>
|
||||
<td align="right">77.16%</td>
|
||||
<td align="left">Negative</td>
|
||||
<td align="right">674</td>
|
||||
<td align="right">13.48%</td>
|
||||
<td align="right">3903</td>
|
||||
<td align="right">78.06%</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="left">3</td>
|
||||
<td align="left">Negative</td>
|
||||
<td align="right">637</td>
|
||||
<td align="right">12.74%</td>
|
||||
<td align="right">4495</td>
|
||||
<td align="right">89.90%</td>
|
||||
<td align="left">Multi-drug-resistant</td>
|
||||
<td align="right">616</td>
|
||||
<td align="right">12.32%</td>
|
||||
<td align="right">4519</td>
|
||||
<td align="right">90.38%</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">4</td>
|
||||
<td align="left">Poly-resistant</td>
|
||||
<td align="right">292</td>
|
||||
<td align="right">5.84%</td>
|
||||
<td align="right">4787</td>
|
||||
<td align="right">95.74%</td>
|
||||
<td align="right">285</td>
|
||||
<td align="right">5.70%</td>
|
||||
<td align="right">4804</td>
|
||||
<td align="right">96.08%</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="left">5</td>
|
||||
<td align="left">Extensively drug-resistant</td>
|
||||
<td align="right">213</td>
|
||||
<td align="right">4.26%</td>
|
||||
<td align="right">196</td>
|
||||
<td align="right">3.92%</td>
|
||||
<td align="right">5000</td>
|
||||
<td align="right">100.00%</td>
|
||||
</tr>
|
||||
|
@ -402,7 +418,7 @@ Unique: 5</p>
|
|||
</div>
|
||||
|
||||
<div class="pkgdown">
|
||||
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.1.</p>
|
||||
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.1.9000.</p>
|
||||
</div>
|
||||
|
||||
</footer>
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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">1.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9001</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -186,7 +186,7 @@
|
|||
<h1 data-toc-skip>How to conduct principal component analysis (PCA) for AMR</h1>
|
||||
<h4 class="author">Matthijs S. Berends</h4>
|
||||
|
||||
<h4 class="date">30 July 2020</h4>
|
||||
<h4 class="date">10 August 2020</h4>
|
||||
|
||||
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/master/vignettes/PCA.Rmd"><code>vignettes/PCA.Rmd</code></a></small>
|
||||
<div class="hidden name"><code>PCA.Rmd</code></div>
|
||||
|
@ -204,9 +204,10 @@
|
|||
<h1 class="hasAnchor">
|
||||
<a href="#transforming" class="anchor"></a>Transforming</h1>
|
||||
<p>For PCA, we need to transform our AMR data first. This is what the <code>example_isolates</code> data set in this package looks like:</p>
|
||||
<div class="sourceCode" id="cb1"><html><body><pre class="r"><span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="no">AMR</span>)
|
||||
<span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="no">dplyr</span>)
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/reexports.html">glimpse</a></span>(<span class="no">example_isolates</span>)
|
||||
<div class="sourceCode" id="cb1"><pre class="downlit">
|
||||
<span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="kw"><a href="https://msberends.github.io/AMR">AMR</a></span>)
|
||||
<span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="kw"><a href="https://dplyr.tidyverse.org">dplyr</a></span>)
|
||||
<span class="fu"><a href="https://tibble.tidyverse.org/reference/glimpse.html">glimpse</a></span>(<span class="kw">example_isolates</span>)
|
||||
<span class="co"># Rows: 2,000</span>
|
||||
<span class="co"># Columns: 49</span>
|
||||
<span class="co"># $ date <date> 2002-01-02, 2002-01-03, 2002-01-07, 2002-01-07, 2002…</span>
|
||||
|
@ -257,16 +258,18 @@
|
|||
<span class="co"># $ CHL <ord> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…</span>
|
||||
<span class="co"># $ COL <ord> NA, NA, R, R, R, R, R, R, R, R, R, R, NA, NA, NA, R, …</span>
|
||||
<span class="co"># $ MUP <ord> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…</span>
|
||||
<span class="co"># $ RIF <ord> R, R, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, R, R, R…</span></pre></body></html></div>
|
||||
<span class="co"># $ RIF <ord> R, R, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, R, R, R…</span>
|
||||
</pre></div>
|
||||
<p>Now to transform this to a data set with only resistance percentages per taxonomic order and genus:</p>
|
||||
<div class="sourceCode" id="cb2"><html><body><pre class="r"><span class="no">resistance_data</span> <span class="kw"><-</span> <span class="no">example_isolates</span> <span class="kw">%>%</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(<span class="kw">order</span> <span class="kw">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_order</a></span>(<span class="no">mo</span>), <span class="co"># group on anything, like order</span>
|
||||
<span class="kw">genus</span> <span class="kw">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="no">mo</span>)) <span class="kw">%>%</span> <span class="co"># and genus as we do here</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/summarise_all.html">summarise_if</a></span>(<span class="no">is.rsi</span>, <span class="no">resistance</span>) <span class="kw">%>%</span> <span class="co"># then get resistance of all drugs</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(<span class="no">order</span>, <span class="no">genus</span>, <span class="no">AMC</span>, <span class="no">CXM</span>, <span class="no">CTX</span>,
|
||||
<span class="no">CAZ</span>, <span class="no">GEN</span>, <span class="no">TOB</span>, <span class="no">TMP</span>, <span class="no">SXT</span>) <span class="co"># and select only relevant columns</span>
|
||||
<div class="sourceCode" id="cb2"><pre class="downlit">
|
||||
<span class="kw">resistance_data</span> <span class="op"><-</span> <span class="kw">example_isolates</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(order = <span class="fu"><a href="../reference/mo_property.html">mo_order</a></span>(<span class="kw">mo</span>), <span class="co"># group on anything, like order</span>
|
||||
genus = <span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="kw">mo</span>)) <span class="op">%>%</span> <span class="co"># and genus as we do here</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/summarise_all.html">summarise_if</a></span>(<span class="kw">is.rsi</span>, <span class="kw">resistance</span>) <span class="op">%>%</span> <span class="co"># then get resistance of all drugs</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(<span class="kw">order</span>, <span class="kw">genus</span>, <span class="kw">AMC</span>, <span class="kw">CXM</span>, <span class="kw">CTX</span>,
|
||||
<span class="kw">CAZ</span>, <span class="kw">GEN</span>, <span class="kw">TOB</span>, <span class="kw">TMP</span>, <span class="kw">SXT</span>) <span class="co"># and select only relevant columns</span>
|
||||
|
||||
<span class="fu"><a href="https://rdrr.io/r/utils/head.html">head</a></span>(<span class="no">resistance_data</span>)
|
||||
<span class="fu"><a href="https://rdrr.io/r/utils/head.html">head</a></span>(<span class="kw">resistance_data</span>)
|
||||
<span class="co"># # A tibble: 6 x 10</span>
|
||||
<span class="co"># # Groups: order [2]</span>
|
||||
<span class="co"># order genus AMC CXM CTX CAZ GEN TOB TMP SXT</span>
|
||||
|
@ -276,35 +279,46 @@
|
|||
<span class="co"># 3 Actinomycetales Cutibacterium NA NA NA NA NA NA NA NA</span>
|
||||
<span class="co"># 4 Actinomycetales Dermabacter NA NA NA NA NA NA NA NA</span>
|
||||
<span class="co"># 5 Actinomycetales Micrococcus NA NA NA NA NA NA NA NA</span>
|
||||
<span class="co"># 6 Actinomycetales Rothia NA NA NA NA NA NA NA NA</span></pre></body></html></div>
|
||||
<span class="co"># 6 Actinomycetales Rothia NA NA NA NA NA NA NA NA</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<div id="perform-principal-component-analysis" class="section level1">
|
||||
<h1 class="hasAnchor">
|
||||
<a href="#perform-principal-component-analysis" class="anchor"></a>Perform principal component analysis</h1>
|
||||
<p>The new <code><a href="../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>
|
||||
<div class="sourceCode" id="cb3"><html><body><pre class="r"><span class="no">pca_result</span> <span class="kw"><-</span> <span class="fu"><a href="../reference/pca.html">pca</a></span>(<span class="no">resistance_data</span>)
|
||||
<div class="sourceCode" id="cb3"><pre class="downlit">
|
||||
<span class="kw">pca_result</span> <span class="op"><-</span> <span class="fu"><a href="../reference/pca.html">pca</a></span>(<span class="kw">resistance_data</span>)
|
||||
<span class="co"># NOTE: Columns selected for PCA: AMC CXM CTX CAZ GEN TOB TMP SXT.</span>
|
||||
<span class="co"># Total observations available: 7.</span></pre></body></html></div>
|
||||
<span class="co"># Total observations available: 7.</span>
|
||||
</pre></div>
|
||||
<p>The result can be reviewed with the good old <code><a href="https://rdrr.io/r/base/summary.html">summary()</a></code> function:</p>
|
||||
<div class="sourceCode" id="cb4"><html><body><pre class="r"><span class="fu"><a href="https://rdrr.io/r/base/summary.html">summary</a></span>(<span class="no">pca_result</span>)
|
||||
<div class="sourceCode" id="cb4"><pre class="downlit">
|
||||
<span class="fu"><a href="https://rdrr.io/r/base/summary.html">summary</a></span>(<span class="kw">pca_result</span>)
|
||||
<span class="co"># Importance of components:</span>
|
||||
<span class="co"># PC1 PC2 PC3 PC4 PC5 PC6 PC7</span>
|
||||
<span class="co"># Standard deviation 2.154 1.6809 0.61305 0.33882 0.20755 0.03137 1.602e-16</span>
|
||||
<span class="co"># Proportion of Variance 0.580 0.3532 0.04698 0.01435 0.00538 0.00012 0.000e+00</span>
|
||||
<span class="co"># Cumulative Proportion 0.580 0.9332 0.98014 0.99449 0.99988 1.00000 1.000e+00</span></pre></body></html></div>
|
||||
<span class="co"># Cumulative Proportion 0.580 0.9332 0.98014 0.99449 0.99988 1.00000 1.000e+00</span>
|
||||
</pre></div>
|
||||
<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><a href="https://rdrr.io/r/stats/biplot.html">biplot()</a></code> function, to see which antimicrobial resistance per drug explain the difference per microorganism.</p>
|
||||
</div>
|
||||
<div id="plotting-the-results" class="section level1">
|
||||
<h1 class="hasAnchor">
|
||||
<a href="#plotting-the-results" class="anchor"></a>Plotting the results</h1>
|
||||
<div class="sourceCode" id="cb5"><html><body><pre class="r"><span class="fu"><a href="https://rdrr.io/r/stats/biplot.html">biplot</a></span>(<span class="no">pca_result</span>)</pre></body></html></div>
|
||||
<div class="sourceCode" id="cb5"><pre class="downlit">
|
||||
<span class="fu"><a href="https://rdrr.io/r/stats/biplot.html">biplot</a></span>(<span class="kw">pca_result</span>)
|
||||
</pre></div>
|
||||
<p><img src="PCA_files/figure-html/unnamed-chunk-5-1.png" width="750"></p>
|
||||
<p>But we can’t see the explanation of the points. Perhaps this works better with our new <code><a href="../reference/ggplot_pca.html">ggplot_pca()</a></code> function, that automatically adds the right labels and even groups:</p>
|
||||
<div class="sourceCode" id="cb6"><html><body><pre class="r"><span class="fu"><a href="../reference/ggplot_pca.html">ggplot_pca</a></span>(<span class="no">pca_result</span>)</pre></body></html></div>
|
||||
<div class="sourceCode" id="cb6"><pre class="downlit">
|
||||
<span class="fu"><a href="../reference/ggplot_pca.html">ggplot_pca</a></span>(<span class="kw">pca_result</span>)
|
||||
</pre></div>
|
||||
<p><img src="PCA_files/figure-html/unnamed-chunk-6-1.png" width="750"></p>
|
||||
<p>You can also print an ellipse per group, and edit the appearance:</p>
|
||||
<div class="sourceCode" id="cb7"><html><body><pre class="r"><span class="fu"><a href="../reference/ggplot_pca.html">ggplot_pca</a></span>(<span class="no">pca_result</span>, <span class="kw">ellipse</span> <span class="kw">=</span> <span class="fl">TRUE</span>) +
|
||||
<span class="kw pkg">ggplot2</span><span class="kw ns">::</span><span class="fu"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span>(<span class="kw">title</span> <span class="kw">=</span> <span class="st">"An AMR/PCA biplot!"</span>)</pre></body></html></div>
|
||||
<div class="sourceCode" id="cb7"><pre class="downlit">
|
||||
<span class="fu"><a href="../reference/ggplot_pca.html">ggplot_pca</a></span>(<span class="kw">pca_result</span>, ellipse = <span class="fl">TRUE</span>) <span class="op">+</span>
|
||||
<span class="kw">ggplot2</span>::<span class="fu"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span>(title = <span class="st">"An AMR/PCA biplot!"</span>)
|
||||
</pre></div>
|
||||
<p><img src="PCA_files/figure-html/unnamed-chunk-7-1.png" width="750"></p>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -324,7 +338,7 @@
|
|||
</div>
|
||||
|
||||
<div class="pkgdown">
|
||||
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.1.</p>
|
||||
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.1.9000.</p>
|
||||
</div>
|
||||
|
||||
</footer>
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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">1.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9001</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -186,7 +186,7 @@
|
|||
<h1 data-toc-skip>How to import data from SPSS / SAS / Stata</h1>
|
||||
<h4 class="author">Matthijs S. Berends</h4>
|
||||
|
||||
<h4 class="date">30 July 2020</h4>
|
||||
<h4 class="date">10 August 2020</h4>
|
||||
|
||||
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/master/vignettes/SPSS.Rmd"><code>vignettes/SPSS.Rmd</code></a></small>
|
||||
<div class="hidden name"><code>SPSS.Rmd</code></div>
|
||||
|
@ -240,7 +240,8 @@
|
|||
</li>
|
||||
</ul>
|
||||
<p>To demonstrate the first point:</p>
|
||||
<div class="sourceCode" id="cb1"><html><body><pre class="r"><span class="co"># not all values are valid MIC values:</span>
|
||||
<div class="sourceCode" id="cb1"><pre class="downlit">
|
||||
<span class="co"># not all values are valid MIC values:</span>
|
||||
<span class="fu"><a href="../reference/as.mic.html">as.mic</a></span>(<span class="fl">0.125</span>)
|
||||
<span class="co"># Class <mic></span>
|
||||
<span class="co"># [1] 0.125</span>
|
||||
|
@ -253,13 +254,13 @@
|
|||
<span class="co"># [1] "Gram-negative"</span>
|
||||
|
||||
<span class="co"># Klebsiella is intrinsic resistant to amoxicllin, according to EUCAST:</span>
|
||||
<span class="no">klebsiella_test</span> <span class="kw"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span>(<span class="kw">mo</span> <span class="kw">=</span> <span class="st">"klebsiella"</span>,
|
||||
<span class="kw">amox</span> <span class="kw">=</span> <span class="st">"S"</span>,
|
||||
<span class="kw">stringsAsFactors</span> <span class="kw">=</span> <span class="fl">FALSE</span>)
|
||||
<span class="no">klebsiella_test</span> <span class="co"># (our original data)</span>
|
||||
<span class="kw">klebsiella_test</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span>(mo = <span class="st">"klebsiella"</span>,
|
||||
amox = <span class="st">"S"</span>,
|
||||
stringsAsFactors = <span class="fl">FALSE</span>)
|
||||
<span class="kw">klebsiella_test</span> <span class="co"># (our original data)</span>
|
||||
<span class="co"># mo amox</span>
|
||||
<span class="co"># 1 klebsiella S</span>
|
||||
<span class="fu"><a href="../reference/eucast_rules.html">eucast_rules</a></span>(<span class="no">klebsiella_test</span>, <span class="kw">info</span> <span class="kw">=</span> <span class="fl">FALSE</span>) <span class="co"># (the edited data by EUCAST rules)</span>
|
||||
<span class="fu"><a href="../reference/eucast_rules.html">eucast_rules</a></span>(<span class="kw">klebsiella_test</span>, info = <span class="fl">FALSE</span>) <span class="co"># (the edited data by EUCAST rules)</span>
|
||||
<span class="co"># mo amox</span>
|
||||
<span class="co"># 1 klebsiella R</span>
|
||||
|
||||
|
@ -271,7 +272,8 @@
|
|||
<span class="co"># [4] "fluclox" "flucloxacilina" "flucloxacillin" </span>
|
||||
<span class="co"># [7] "flucloxacilline" "flucloxacillinum" "fluorochloroxacillin"</span>
|
||||
<span class="fu"><a href="../reference/ab_property.html">ab_atc</a></span>(<span class="st">"floxapen"</span>)
|
||||
<span class="co"># [1] "J01CF05"</span></pre></body></html></div>
|
||||
<span class="co"># [1] "J01CF05"</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<div id="import-data-from-spsssasstata" class="section level2">
|
||||
<h2 class="hasAnchor">
|
||||
|
@ -287,7 +289,8 @@
|
|||
<p><img src="https://github.com/msberends/AMR/raw/master/docs/import2.png"></p>
|
||||
<p>If you want named variables to be imported as factors so it resembles SPSS more, use <code><a href="https://haven.tidyverse.org/reference/as_factor.html">as_factor()</a></code>.</p>
|
||||
<p>The difference is this:</p>
|
||||
<div class="sourceCode" id="cb2"><html><body><pre class="r"><span class="no">SPSS_data</span>
|
||||
<div class="sourceCode" id="cb2"><pre class="downlit">
|
||||
<span class="kw">SPSS_data</span>
|
||||
<span class="co"># # A tibble: 4,203 x 4</span>
|
||||
<span class="co"># v001 sex status statusage</span>
|
||||
<span class="co"># <dbl> <dbl+lbl> <dbl+lbl> <dbl></span>
|
||||
|
@ -303,7 +306,7 @@
|
|||
<span class="co"># 10 10018 0 1 66.6</span>
|
||||
<span class="co"># # … with 4,193 more rows</span>
|
||||
|
||||
<span class="fu">as_factor</span>(<span class="no">SPSS_data</span>)
|
||||
<span class="fu">as_factor</span>(<span class="kw">SPSS_data</span>)
|
||||
<span class="co"># # A tibble: 4,203 x 4</span>
|
||||
<span class="co"># v001 sex status statusage</span>
|
||||
<span class="co"># <dbl> <fct> <fct> <dbl></span>
|
||||
|
@ -317,67 +320,82 @@
|
|||
<span class="co"># 8 10011 Male alive 73.1</span>
|
||||
<span class="co"># 9 10017 Male alive 56.7</span>
|
||||
<span class="co"># 10 10018 Female alive 66.6</span>
|
||||
<span class="co"># # … with 4,193 more rows</span></pre></body></html></div>
|
||||
<span class="co"># # … with 4,193 more rows</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<div id="base-r" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#base-r" class="anchor"></a>Base R</h3>
|
||||
<p>To import data from SPSS, SAS or Stata, you can use the <a href="https://haven.tidyverse.org/">great <code>haven</code> package</a> yourself:</p>
|
||||
<div class="sourceCode" id="cb3"><html><body><pre class="r"><span class="co"># download and install the latest version:</span>
|
||||
<div class="sourceCode" id="cb3"><pre class="downlit">
|
||||
<span class="co"># download and install the latest version:</span>
|
||||
<span class="fu"><a href="https://rdrr.io/r/utils/install.packages.html">install.packages</a></span>(<span class="st">"haven"</span>)
|
||||
<span class="co"># load the package you just installed:</span>
|
||||
<span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="no">haven</span>)</pre></body></html></div>
|
||||
<span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="kw"><a href="http://haven.tidyverse.org">haven</a></span>)
|
||||
</pre></div>
|
||||
<p>You can now import files as follows:</p>
|
||||
<div id="spss" class="section level4">
|
||||
<h4 class="hasAnchor">
|
||||
<a href="#spss" class="anchor"></a>SPSS</h4>
|
||||
<p>To read files from SPSS into R:</p>
|
||||
<div class="sourceCode" id="cb4"><html><body><pre class="r"><span class="co"># read any SPSS file based on file extension (best way):</span>
|
||||
<span class="fu"><a href="https://haven.tidyverse.org/reference/read_spss.html">read_spss</a></span>(<span class="kw">file</span> <span class="kw">=</span> <span class="st">"path/to/file"</span>)
|
||||
<div class="sourceCode" id="cb4"><pre class="downlit">
|
||||
<span class="co"># read any SPSS file based on file extension (best way):</span>
|
||||
<span class="fu"><a href="https://haven.tidyverse.org/reference/read_spss.html">read_spss</a></span>(file = <span class="st">"path/to/file"</span>)
|
||||
|
||||
<span class="co"># read .sav or .zsav file:</span>
|
||||
<span class="fu"><a href="https://haven.tidyverse.org/reference/read_spss.html">read_sav</a></span>(<span class="kw">file</span> <span class="kw">=</span> <span class="st">"path/to/file"</span>)
|
||||
<span class="fu"><a href="https://haven.tidyverse.org/reference/read_spss.html">read_sav</a></span>(file = <span class="st">"path/to/file"</span>)
|
||||
|
||||
<span class="co"># read .por file:</span>
|
||||
<span class="fu"><a href="https://haven.tidyverse.org/reference/read_spss.html">read_por</a></span>(<span class="kw">file</span> <span class="kw">=</span> <span class="st">"path/to/file"</span>)</pre></body></html></div>
|
||||
<span class="fu"><a href="https://haven.tidyverse.org/reference/read_spss.html">read_por</a></span>(file = <span class="st">"path/to/file"</span>)
|
||||
</pre></div>
|
||||
<p>Do not forget about <code><a href="https://haven.tidyverse.org/reference/as_factor.html">as_factor()</a></code>, as mentioned above.</p>
|
||||
<p>To export your R objects to the SPSS file format:</p>
|
||||
<div class="sourceCode" id="cb5"><html><body><pre class="r"><span class="co"># save as .sav file:</span>
|
||||
<span class="fu"><a href="https://haven.tidyverse.org/reference/read_spss.html">write_sav</a></span>(<span class="kw">data</span> <span class="kw">=</span> <span class="no">yourdata</span>, <span class="kw">path</span> <span class="kw">=</span> <span class="st">"path/to/file"</span>)
|
||||
<div class="sourceCode" id="cb5"><pre class="downlit">
|
||||
<span class="co"># save as .sav file:</span>
|
||||
<span class="fu"><a href="https://haven.tidyverse.org/reference/read_spss.html">write_sav</a></span>(data = <span class="kw">yourdata</span>, path = <span class="st">"path/to/file"</span>)
|
||||
|
||||
<span class="co"># save as compressed .zsav file:</span>
|
||||
<span class="fu"><a href="https://haven.tidyverse.org/reference/read_spss.html">write_sav</a></span>(<span class="kw">data</span> <span class="kw">=</span> <span class="no">yourdata</span>, <span class="kw">path</span> <span class="kw">=</span> <span class="st">"path/to/file"</span>, <span class="kw">compress</span> <span class="kw">=</span> <span class="fl">TRUE</span>)</pre></body></html></div>
|
||||
<span class="fu"><a href="https://haven.tidyverse.org/reference/read_spss.html">write_sav</a></span>(data = <span class="kw">yourdata</span>, path = <span class="st">"path/to/file"</span>, compress = <span class="fl">TRUE</span>)
|
||||
</pre></div>
|
||||
</div>
|
||||
<div id="sas" class="section level4">
|
||||
<h4 class="hasAnchor">
|
||||
<a href="#sas" class="anchor"></a>SAS</h4>
|
||||
<p>To read files from SAS into R:</p>
|
||||
<div class="sourceCode" id="cb6"><html><body><pre class="r"><span class="co"># read .sas7bdat + .sas7bcat files:</span>
|
||||
<span class="fu"><a href="https://haven.tidyverse.org/reference/read_sas.html">read_sas</a></span>(<span class="kw">data_file</span> <span class="kw">=</span> <span class="st">"path/to/file"</span>, <span class="kw">catalog_file</span> <span class="kw">=</span> <span class="kw">NULL</span>)
|
||||
<div class="sourceCode" id="cb6"><pre class="downlit">
|
||||
<span class="co"># read .sas7bdat + .sas7bcat files:</span>
|
||||
<span class="fu"><a href="https://haven.tidyverse.org/reference/read_sas.html">read_sas</a></span>(data_file = <span class="st">"path/to/file"</span>, catalog_file = <span class="kw">NULL</span>)
|
||||
|
||||
<span class="co"># read SAS transport files (version 5 and version 8):</span>
|
||||
<span class="fu"><a href="https://haven.tidyverse.org/reference/read_xpt.html">read_xpt</a></span>(<span class="kw">file</span> <span class="kw">=</span> <span class="st">"path/to/file"</span>)</pre></body></html></div>
|
||||
<span class="fu"><a href="https://haven.tidyverse.org/reference/read_xpt.html">read_xpt</a></span>(file = <span class="st">"path/to/file"</span>)
|
||||
</pre></div>
|
||||
<p>To export your R objects to the SAS file format:</p>
|
||||
<div class="sourceCode" id="cb7"><html><body><pre class="r"><span class="co"># save as regular SAS file:</span>
|
||||
<span class="fu"><a href="https://haven.tidyverse.org/reference/read_sas.html">write_sas</a></span>(<span class="kw">data</span> <span class="kw">=</span> <span class="no">yourdata</span>, <span class="kw">path</span> <span class="kw">=</span> <span class="st">"path/to/file"</span>)
|
||||
<div class="sourceCode" id="cb7"><pre class="downlit">
|
||||
<span class="co"># save as regular SAS file:</span>
|
||||
<span class="fu"><a href="https://haven.tidyverse.org/reference/read_sas.html">write_sas</a></span>(data = <span class="kw">yourdata</span>, path = <span class="st">"path/to/file"</span>)
|
||||
|
||||
<span class="co"># the SAS transport format is an open format </span>
|
||||
<span class="co"># (required for submission of the data to the FDA)</span>
|
||||
<span class="fu"><a href="https://haven.tidyverse.org/reference/read_xpt.html">write_xpt</a></span>(<span class="kw">data</span> <span class="kw">=</span> <span class="no">yourdata</span>, <span class="kw">path</span> <span class="kw">=</span> <span class="st">"path/to/file"</span>, <span class="kw">version</span> <span class="kw">=</span> <span class="fl">8</span>)</pre></body></html></div>
|
||||
<span class="fu"><a href="https://haven.tidyverse.org/reference/read_xpt.html">write_xpt</a></span>(data = <span class="kw">yourdata</span>, path = <span class="st">"path/to/file"</span>, version = <span class="fl">8</span>)
|
||||
</pre></div>
|
||||
</div>
|
||||
<div id="stata" class="section level4">
|
||||
<h4 class="hasAnchor">
|
||||
<a href="#stata" class="anchor"></a>Stata</h4>
|
||||
<p>To read files from Stata into R:</p>
|
||||
<div class="sourceCode" id="cb8"><html><body><pre class="r"><span class="co"># read .dta file:</span>
|
||||
<span class="fu"><a href="https://haven.tidyverse.org/reference/read_dta.html">read_stata</a></span>(<span class="kw">file</span> <span class="kw">=</span> <span class="st">"/path/to/file"</span>)
|
||||
<div class="sourceCode" id="cb8"><pre class="downlit">
|
||||
<span class="co"># read .dta file:</span>
|
||||
<span class="fu"><a href="https://haven.tidyverse.org/reference/read_dta.html">read_stata</a></span>(file = <span class="st">"/path/to/file"</span>)
|
||||
|
||||
<span class="co"># works exactly the same:</span>
|
||||
<span class="fu"><a href="https://haven.tidyverse.org/reference/read_dta.html">read_dta</a></span>(<span class="kw">file</span> <span class="kw">=</span> <span class="st">"/path/to/file"</span>)</pre></body></html></div>
|
||||
<span class="fu"><a href="https://haven.tidyverse.org/reference/read_dta.html">read_dta</a></span>(file = <span class="st">"/path/to/file"</span>)
|
||||
</pre></div>
|
||||
<p>To export your R objects to the Stata file format:</p>
|
||||
<div class="sourceCode" id="cb9"><html><body><pre class="r"><span class="co"># save as .dta file, Stata version 14:</span>
|
||||
<div class="sourceCode" id="cb9"><pre class="downlit">
|
||||
<span class="co"># save as .dta file, Stata version 14:</span>
|
||||
<span class="co"># (supports Stata v8 until v15 at the time of writing)</span>
|
||||
<span class="fu"><a href="https://haven.tidyverse.org/reference/read_dta.html">write_dta</a></span>(<span class="kw">data</span> <span class="kw">=</span> <span class="no">yourdata</span>, <span class="kw">path</span> <span class="kw">=</span> <span class="st">"/path/to/file"</span>, <span class="kw">version</span> <span class="kw">=</span> <span class="fl">14</span>)</pre></body></html></div>
|
||||
<span class="fu"><a href="https://haven.tidyverse.org/reference/read_dta.html">write_dta</a></span>(data = <span class="kw">yourdata</span>, path = <span class="st">"/path/to/file"</span>, version = <span class="fl">14</span>)
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -398,7 +416,7 @@
|
|||
</div>
|
||||
|
||||
<div class="pkgdown">
|
||||
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.1.</p>
|
||||
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.1.9000.</p>
|
||||
</div>
|
||||
|
||||
</footer>
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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">1.3.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9001</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -186,7 +186,7 @@
|
|||
<h1 data-toc-skip>How to work with WHONET data</h1>
|
||||
<h4 class="author">Matthijs S. Berends</h4>
|
||||
|
||||
<h4 class="date">30 July 2020</h4>
|
||||
<h4 class="date">10 August 2020</h4>
|
||||
|
||||
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/master/vignettes/WHONET.Rmd"><code>vignettes/WHONET.Rmd</code></a></small>
|
||||
<div class="hidden name"><code>WHONET.Rmd</code></div>
|
||||
|
@ -200,34 +200,42 @@
|
|||
<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>An example syntax could look like this:</p>
|
||||
<div class="sourceCode" id="cb1"><html><body><pre class="r"><span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="no">readxl</span>)
|
||||
<span class="no">data</span> <span class="kw"><-</span> <span class="fu"><a href="https://readxl.tidyverse.org/reference/read_excel.html">read_excel</a></span>(<span class="kw">path</span> <span class="kw">=</span> <span class="st">"path/to/your/file.xlsx"</span>)</pre></body></html></div>
|
||||
<div class="sourceCode" id="cb1"><pre class="downlit">
|
||||
<span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="kw"><a href="https://readxl.tidyverse.org">readxl</a></span>)
|
||||
<span class="kw">data</span> <span class="op"><-</span> <span class="fu"><a href="https://readxl.tidyverse.org/reference/read_excel.html">read_excel</a></span>(path = <span class="st">"path/to/your/file.xlsx"</span>)
|
||||
</pre></div>
|
||||
<p>This package comes with an <a href="https://msberends.github.io/AMR/reference/WHONET.html">example data set <code>WHONET</code></a>. We will use it for this analysis.</p>
|
||||
</div>
|
||||
<div id="preparation" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<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>
|
||||
<div class="sourceCode" id="cb2"><html><body><pre class="r"><span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="no">dplyr</span>) <span class="co"># part of tidyverse</span>
|
||||
<span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="no">ggplot2</span>) <span class="co"># part of tidyverse</span>
|
||||
<span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="no">AMR</span>) <span class="co"># this package</span>
|
||||
<span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="no">cleaner</span>) <span class="co"># to create frequency tables</span></pre></body></html></div>
|
||||
<div class="sourceCode" id="cb2"><pre class="downlit">
|
||||
<span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="kw"><a href="https://dplyr.tidyverse.org">dplyr</a></span>) <span class="co"># part of tidyverse</span>
|
||||
<span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="kw"><a href="http://ggplot2.tidyverse.org">ggplot2</a></span>) <span class="co"># part of tidyverse</span>
|
||||
<span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="kw"><a href="https://msberends.github.io/AMR">AMR</a></span>) <span class="co"># this package</span>
|
||||
<span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="kw"><a href="https://github.com/msberends/cleaner">cleaner</a></span>) <span class="co"># to create frequency tables</span>
|
||||
</pre></div>
|
||||
<p>We will have to transform some variables to simplify and automate the analysis:</p>
|
||||
<ul>
|
||||
<li>Microorganisms should be transformed to our own microorganism IDs (called an <code>mo</code>) using <a href="https://msberends.github.io/AMR/reference/catalogue_of_life">our Catalogue of Life reference data set</a>, which contains all ~70,000 microorganisms from the taxonomic kingdoms Bacteria, Fungi and Protozoa. We do the tranformation with <code><a href="../reference/as.mo.html">as.mo()</a></code>. This function also recognises almost all WHONET abbreviations of microorganisms.</li>
|
||||
<li>Antimicrobial results or interpretations have to be clean and valid. In other words, they should only contain values <code>"S"</code>, <code>"I"</code> or <code>"R"</code>. That is exactly where the <code><a href="../reference/as.rsi.html">as.rsi()</a></code> function is for.</li>
|
||||
</ul>
|
||||
<div class="sourceCode" id="cb3"><html><body><pre class="r"><span class="co"># transform variables</span>
|
||||
<span class="no">data</span> <span class="kw"><-</span> <span class="no">WHONET</span> <span class="kw">%>%</span>
|
||||
<div class="sourceCode" id="cb3"><pre class="downlit">
|
||||
<span class="co"># transform variables</span>
|
||||
<span class="kw">data</span> <span class="op"><-</span> <span class="kw">WHONET</span> <span class="op">%>%</span>
|
||||
<span class="co"># get microbial ID based on given organism</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="kw">mo</span> <span class="kw">=</span> <span class="fu"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="no">Organism</span>)) <span class="kw">%>%</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(mo = <span class="fu"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="kw">Organism</span>)) <span class="op">%>%</span>
|
||||
<span class="co"># transform everything from "AMP_ND10" to "CIP_EE" to the new `rsi` class</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_at</a></span>(<span class="fu"><a href="https://dplyr.tidyverse.org/reference/vars.html">vars</a></span>(<span class="no">AMP_ND10</span>:<span class="no">CIP_EE</span>), <span class="no">as.rsi</span>)</pre></body></html></div>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_at</a></span>(<span class="fu"><a href="https://dplyr.tidyverse.org/reference/vars.html">vars</a></span>(<span class="kw">AMP_ND10</span><span class="op">:</span><span class="kw">CIP_EE</span>), <span class="kw">as.rsi</span>)
|
||||
</pre></div>
|
||||
<p>No errors or warnings, so all values are transformed succesfully.</p>
|
||||
<p>We also created a package dedicated to data cleaning and checking, called the <code>cleaner</code> package. Its <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code> function can be used to create frequency tables.</p>
|
||||
<p>So let’s check our data, with a couple of frequency tables:</p>
|
||||
<div class="sourceCode" id="cb4"><html><body><pre class="r"><span class="co"># our newly created `mo` variable, put in the mo_name() function</span>
|
||||
<span class="no">data</span> <span class="kw">%>%</span> <span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="fu"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="no">mo</span>), <span class="kw">nmax</span> <span class="kw">=</span> <span class="fl">10</span>)</pre></body></html></div>
|
||||
<div class="sourceCode" id="cb4"><pre class="downlit">
|
||||
<span class="co"># our newly created `mo` variable, put in the mo_name() function</span>
|
||||
<span class="kw">data</span> <span class="op">%>%</span> <span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="fu"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="kw">mo</span>), nmax = <span class="fl">10</span>)
|
||||
</pre></div>
|
||||
<p><strong>Frequency table</strong></p>
|
||||
<p>Class: character<br>
|
||||
Length: 500<br>
|
||||
|
@ -328,9 +336,11 @@ Longest: 40</p>
|
|||
</tbody>
|
||||
</table>
|
||||
<p>(omitted 27 entries, n = 56 [11.20%])</p>
|
||||
<div class="sourceCode" id="cb5"><html><body><pre class="r"><span class="co"># our transformed antibiotic columns</span>
|
||||
<div class="sourceCode" id="cb5"><pre class="downlit">
|
||||
<span class="co"># our transformed antibiotic columns</span>
|
||||
<span class="co"># amoxicillin/clavulanic acid (J01CR02) as an example</span>
|
||||
<span class="no">data</span> <span class="kw">%>%</span> <span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="no">AMC_ND2</span>)</pre></body></html></div>
|
||||
<span class="kw">data</span> <span class="op">%>%</span> <span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="kw">AMC_ND2</span>)
|
||||
</pre></div>
|
||||
<p><strong>Frequency table</strong></p>
|
||||
<p>Class: factor > ordered > rsi (numeric)<br>
|
||||
Length: 500<br>
|
||||
|
@ -378,10 +388,12 @@ Unique: 3</p>
|
|||
<h3 class="hasAnchor">
|
||||
<a href="#a-first-glimpse-at-results" class="anchor"></a>A first glimpse at results</h3>
|
||||
<p>An easy <code>ggplot</code> 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"><html><body><pre class="r"><span class="no">data</span> <span class="kw">%>%</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(<span class="no">Country</span>) <span class="kw">%>%</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(<span class="no">Country</span>, <span class="no">AMP_ND2</span>, <span class="no">AMC_ED20</span>, <span class="no">CAZ_ED10</span>, <span class="no">CIP_ED5</span>) <span class="kw">%>%</span>
|
||||
<span class="fu"><a href="../reference/ggplot_rsi.html">ggplot_rsi</a></span>(<span class="kw">translate_ab</span> <span class="kw">=</span> <span class="st">'ab'</span>, <span class="kw">facet</span> <span class="kw">=</span> <span class="st">"Country"</span>, <span class="kw">datalabels</span> <span class="kw">=</span> <span class="fl">FALSE</span>)</pre></body></html></div>
|
||||
<div class="sourceCode" id="cb6"><pre class="downlit">
|
||||
<span class="kw">data</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(<span class="kw">Country</span>) <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(<span class="kw">Country</span>, <span class="kw">AMP_ND2</span>, <span class="kw">AMC_ED20</span>, <span class="kw">CAZ_ED10</span>, <span class="kw">CIP_ED5</span>) <span class="op">%>%</span>
|
||||
<span class="fu"><a href="../reference/ggplot_rsi.html">ggplot_rsi</a></span>(translate_ab = <span class="st">'ab'</span>, facet = <span class="st">"Country"</span>, datalabels = <span class="fl">FALSE</span>)
|
||||
</pre></div>
|
||||
<p><img src="WHONET_files/figure-html/unnamed-chunk-7-1.png" width="720"></p>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -399,7 +411,7 @@ Unique: 3</p>
|
|||
</div>
|
||||
|
||||
<div class="pkgdown">
|
||||
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.1.</p>
|
||||
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.1.9000.</p>
|
||||
</div>
|
||||
|
||||
</footer>
|
||||
|
|