mirror of
https://github.com/msberends/AMR.git
synced 2025-07-25 02:07:25 +02:00
(v1.3.0.9035) mdro() for EUCAST 3.2, examples cleanup
This commit is contained in:
@ -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.9034</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -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.9034</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -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.9034</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -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.9034</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -43,7 +43,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.9034</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -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.9034</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -236,20 +236,27 @@
|
||||
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
|
||||
</div>
|
||||
|
||||
<div id="amr-1309034" class="section level1">
|
||||
<h1 class="page-header" data-toc-text="1.3.0.9034">
|
||||
<a href="#amr-1309034" class="anchor"></a>AMR 1.3.0.9034<small> Unreleased </small>
|
||||
<div id="amr-1309035" class="section level1">
|
||||
<h1 class="page-header" data-toc-text="1.3.0.9035">
|
||||
<a href="#amr-1309035" class="anchor"></a>AMR 1.3.0.9035<small> Unreleased </small>
|
||||
</h1>
|
||||
<div id="last-updated-29-september-2020" class="section level2">
|
||||
<h2 class="hasAnchor">
|
||||
<a href="#last-updated-29-september-2020" class="anchor"></a><small>Last updated: 29 September 2020</small>
|
||||
</h2>
|
||||
<p>Note: some changes in this version were suggested by anonymous reviewers from the journal we submitted our manuscipt to. We are those reviewers very grateful for going through our code so thoroughly!</p>
|
||||
<div id="breaking" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#breaking" class="anchor"></a>Breaking</h3>
|
||||
<ul>
|
||||
<li>Removed functions <code>portion_R()</code>, <code>portion_S()</code> and <code>portion_I()</code> that were deprecated since version 0.9.0 (November 2019) and were replaced with <code><a href="../reference/proportion.html">proportion_R()</a></code>, <code><a href="../reference/proportion.html">proportion_S()</a></code> and <code><a href="../reference/proportion.html">proportion_I()</a></code>.</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="new" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#new" class="anchor"></a>New</h3>
|
||||
<ul>
|
||||
<li><p>Support for ‘EUCAST Expert Rules’ / ‘EUCAST Intrinsic Resistance and Unusual Phenotypes’ version 3.2 of May 2020. With this addition to the previously implemented version 3.1 of 2016, the <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> function can now correct for more than 180 different antibiotics. All previously implemented versions of the EUCAST rules are now maintained and kept available in this package. The <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> function consequently gained the parameters <code>version_breakpoints</code> (at the moment defaults to v10.0, 2020) and <code>version_expertrules</code> (at the moment defaults to v3.2, 2020). The <code>example_isolates</code> data set now also reflects the change from v3.1 to v3.2.</p></li>
|
||||
<li><p>Support for ‘EUCAST Expert Rules’ / ‘EUCAST Intrinsic Resistance and Unusual Phenotypes’ version 3.2 of May 2020. With this addition to the previously implemented version 3.1 of 2016, the <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> function can now correct for more than 180 different antibiotics and the <code><a href="../reference/mdro.html">mdro()</a></code> function can determine multidrug resistance based on more than 150 different antibiotics. All previously implemented versions of the EUCAST rules are now maintained and kept available in this package. The <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> function consequently gained the parameters <code>version_breakpoints</code> (at the moment defaults to v10.0, 2020) and <code>version_expertrules</code> (at the moment defaults to v3.2, 2020). The <code>example_isolates</code> data set now also reflects the change from v3.1 to v3.2. The <code><a href="../reference/mdro.html">mdro()</a></code> function now accepts <code>guideline == "EUCAST3.1"</code> and <code>guideline == "EUCAST3.2"</code>.</p></li>
|
||||
<li><p>A new vignette and website page with info about all our public and freely available data sets, that can be downloaded as flat files or in formats for use in R, SPSS, SAS, Stata and Excel: <a href="https://msberends.github.io/AMR/articles/datasets.html" class="uri">https://msberends.github.io/AMR/articles/datasets.html</a></p></li>
|
||||
<li>
|
||||
<p>Data set <code>intrinsic_resistant</code>. This data set contains all bug-drug combinations where the ‘bug’ is intrinsic resistant to the ‘drug’ according to the latest EUCAST insights. It contains just two columns: <code>microorganism</code> and <code>antibiotic</code>.</p>
|
||||
@ -430,9 +437,9 @@
|
||||
<h1 class="page-header" data-toc-text="1.2.0">
|
||||
<a href="#amr-120" class="anchor"></a>AMR 1.2.0<small> 2020-05-28 </small>
|
||||
</h1>
|
||||
<div id="breaking" class="section level3">
|
||||
<div id="breaking-1" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#breaking" class="anchor"></a>Breaking</h3>
|
||||
<a href="#breaking-1" class="anchor"></a>Breaking</h3>
|
||||
<ul>
|
||||
<li>
|
||||
<p>Removed code dependency on all other R packages, making this package fully independent of the development process of others. This is a major code change, but will probably not be noticeable by most users.</p>
|
||||
@ -640,9 +647,9 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<h1 class="page-header" data-toc-text="0.9.0">
|
||||
<a href="#amr-090" class="anchor"></a>AMR 0.9.0<small> 2019-11-29 </small>
|
||||
</h1>
|
||||
<div id="breaking-1" class="section level3">
|
||||
<div id="breaking-2" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#breaking-1" class="anchor"></a>Breaking</h3>
|
||||
<a href="#breaking-2" class="anchor"></a>Breaking</h3>
|
||||
<ul>
|
||||
<li>Adopted Adeolu <em>et al.</em> (2016), <a href="https://www.ncbi.nlm.nih.gov/pubmed/27620848">PMID 27620848</a> for the <code>microorganisms</code> data set, which means that the new order Enterobacterales now consists of a part of the existing family Enterobacteriaceae, but that this family has been split into other families as well (like <em>Morganellaceae</em> and <em>Yersiniaceae</em>). Although published in 2016, this information is not yet in the Catalogue of Life version of 2019. All MDRO determinations with <code><a href="../reference/mdro.html">mdro()</a></code> will now use the Enterobacterales order for all guidelines before 2016 that were dependent on the Enterobacteriaceae family.
|
||||
<ul>
|
||||
@ -748,9 +755,9 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<h1 class="page-header" data-toc-text="0.8.0">
|
||||
<a href="#amr-080" class="anchor"></a>AMR 0.8.0<small> 2019-10-15 </small>
|
||||
</h1>
|
||||
<div id="breaking-2" class="section level3">
|
||||
<div id="breaking-3" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#breaking-2" class="anchor"></a>Breaking</h3>
|
||||
<a href="#breaking-3" class="anchor"></a>Breaking</h3>
|
||||
<ul>
|
||||
<li>
|
||||
<p>Determination of first isolates now <strong>excludes</strong> all ‘unknown’ microorganisms at default, i.e. microbial code <code>"UNKNOWN"</code>. They can be included with the new parameter <code>include_unknown</code>:</p>
|
||||
@ -889,7 +896,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<li>The <code>antibiotics</code> data set is now sorted by name and all cephalosporins now have their generation between brackets</li>
|
||||
<li>Speed improvement for <code><a href="../reference/guess_ab_col.html">guess_ab_col()</a></code> which is now 30 times faster for antibiotic abbreviations</li>
|
||||
<li>Improved <code><a href="../reference/filter_ab_class.html">filter_ab_class()</a></code> to be more reliable and to support 5th generation cephalosporins</li>
|
||||
<li>Function <code><a href="../reference/availability.html">availability()</a></code> now uses <code><a href="../reference/AMR-deprecated.html">portion_R()</a></code> instead of <code><a href="../reference/AMR-deprecated.html">portion_IR()</a></code>, to comply with EUCAST insights</li>
|
||||
<li>Function <code><a href="../reference/availability.html">availability()</a></code> now uses <code>portion_R()</code> instead of <code>portion_IR()</code>, to comply with EUCAST insights</li>
|
||||
<li>Functions <code><a href="../reference/age.html">age()</a></code> and <code><a href="../reference/age_groups.html">age_groups()</a></code> now have a <code>na.rm</code> parameter to remove empty values</li>
|
||||
<li>Renamed function <code>p.symbol()</code> to <code><a href="../reference/p_symbol.html">p_symbol()</a></code> (the former is now deprecated and will be removed in a future version)</li>
|
||||
<li>Using negative values for <code>x</code> in <code><a href="../reference/age_groups.html">age_groups()</a></code> will now introduce <code>NA</code>s and not return an error anymore</li>
|
||||
@ -919,7 +926,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<a href="#new-6" class="anchor"></a>New</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<p>Function <code><a href="../reference/proportion.html">rsi_df()</a></code> to transform a <code>data.frame</code> to a data set containing only the microbial interpretation (S, I, R), the antibiotic, the percentage of S/I/R and the number of available isolates. This is a convenient combination of the existing functions <code><a href="../reference/count.html">count_df()</a></code> and <code><a href="../reference/AMR-deprecated.html">portion_df()</a></code> to immediately show resistance percentages and number of available isolates:</p>
|
||||
<p>Function <code><a href="../reference/proportion.html">rsi_df()</a></code> to transform a <code>data.frame</code> to a data set containing only the microbial interpretation (S, I, R), the antibiotic, the percentage of S/I/R and the number of available isolates. This is a convenient combination of the existing functions <code><a href="../reference/count.html">count_df()</a></code> and <code>portion_df()</code> to immediately show resistance percentages and number of available isolates:</p>
|
||||
<div class="sourceCode" id="cb18"><pre class="downlit">
|
||||
<span class="kw">septic_patients</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(<span class="kw">AMX</span>, <span class="kw">CIP</span>) <span class="op">%>%</span>
|
||||
@ -964,7 +971,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<h4 class="hasAnchor">
|
||||
<a href="#changed-6" class="anchor"></a>Changed</h4>
|
||||
<ul>
|
||||
<li>Column names of output <code><a href="../reference/count.html">count_df()</a></code> and <code><a href="../reference/AMR-deprecated.html">portion_df()</a></code> are now lowercase</li>
|
||||
<li>Column names of output <code><a href="../reference/count.html">count_df()</a></code> and <code>portion_df()</code> are now lowercase</li>
|
||||
<li>Fixed bug in translation of microorganism names</li>
|
||||
<li>Fixed bug in determining taxonomic kingdoms</li>
|
||||
<li>Algorithm improvements for <code><a href="../reference/as.ab.html">as.ab()</a></code> and <code><a href="../reference/as.mo.html">as.mo()</a></code> to understand even more severely misspelled input</li>
|
||||
@ -1041,7 +1048,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<li>Improved intelligence of looking up antibiotic columns in a data set using <code><a href="../reference/guess_ab_col.html">guess_ab_col()</a></code>
|
||||
</li>
|
||||
<li>Added ~5,000 more old taxonomic names to the <code>microorganisms.old</code> data set, which leads to better results finding when using the <code><a href="../reference/as.mo.html">as.mo()</a></code> function</li>
|
||||
<li>This package now honours the new EUCAST insight (2019) that S and I are but classified as susceptible, where I is defined as ‘increased exposure’ and not ‘intermediate’ anymore. For functions like <code><a href="../reference/AMR-deprecated.html">portion_df()</a></code> and <code><a href="../reference/count.html">count_df()</a></code> this means that their new parameter <code>combine_SI</code> is TRUE at default. Our plotting function <code><a href="../reference/ggplot_rsi.html">ggplot_rsi()</a></code> also reflects this change since it uses <code><a href="../reference/count.html">count_df()</a></code> internally.</li>
|
||||
<li>This package now honours the new EUCAST insight (2019) that S and I are but classified as susceptible, where I is defined as ‘increased exposure’ and not ‘intermediate’ anymore. For functions like <code>portion_df()</code> and <code><a href="../reference/count.html">count_df()</a></code> this means that their new parameter <code>combine_SI</code> is TRUE at default. Our plotting function <code><a href="../reference/ggplot_rsi.html">ggplot_rsi()</a></code> also reflects this change since it uses <code><a href="../reference/count.html">count_df()</a></code> internally.</li>
|
||||
<li>The <code><a href="../reference/age.html">age()</a></code> function gained a new parameter <code>exact</code> to determine ages with decimals</li>
|
||||
<li>Removed deprecated functions <code>guess_mo()</code>, <code>guess_atc()</code>, <code>EUCAST_rules()</code>, <code>interpretive_reading()</code>, <code><a href="../reference/as.rsi.html">rsi()</a></code>
|
||||
</li>
|
||||
@ -1595,9 +1602,9 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<span class="co"># which is the same as:</span>
|
||||
<span class="kw">septic_patients</span> <span class="op">%>%</span> <span class="fu"><a href="../reference/count.html">count_IR</a></span>(<span class="kw">amox</span>, <span class="kw">cipr</span>)
|
||||
|
||||
<span class="kw">septic_patients</span> <span class="op">%>%</span> <span class="fu"><a href="../reference/AMR-deprecated.html">portion_S</a></span>(<span class="kw">amcl</span>)
|
||||
<span class="kw">septic_patients</span> <span class="op">%>%</span> <span class="fu"><a href="../reference/AMR-deprecated.html">portion_S</a></span>(<span class="kw">amcl</span>, <span class="kw">gent</span>)
|
||||
<span class="kw">septic_patients</span> <span class="op">%>%</span> <span class="fu"><a href="../reference/AMR-deprecated.html">portion_S</a></span>(<span class="kw">amcl</span>, <span class="kw">gent</span>, <span class="kw">pita</span>)
|
||||
<span class="kw">septic_patients</span> <span class="op">%>%</span> <span class="fu">portion_S</span>(<span class="kw">amcl</span>)
|
||||
<span class="kw">septic_patients</span> <span class="op">%>%</span> <span class="fu">portion_S</span>(<span class="kw">amcl</span>, <span class="kw">gent</span>)
|
||||
<span class="kw">septic_patients</span> <span class="op">%>%</span> <span class="fu">portion_S</span>(<span class="kw">amcl</span>, <span class="kw">gent</span>, <span class="kw">pita</span>)
|
||||
</pre></div>
|
||||
</li>
|
||||
<li><p>Edited <code>ggplot_rsi</code> and <code>geom_rsi</code> so they can cope with <code>count_df</code>. The new <code>fun</code> parameter has value <code>portion_df</code> at default, but can be set to <code>count_df</code>.</p></li>
|
||||
|
@ -2,7 +2,7 @@ pandoc: 2.7.3
|
||||
pkgdown: 1.5.1.9000
|
||||
pkgdown_sha: eae56f08694abebf93cdfc0dd8e9ede06d8c815f
|
||||
articles: []
|
||||
last_built: 2020-09-29T08:40Z
|
||||
last_built: 2020-09-29T21:35Z
|
||||
urls:
|
||||
reference: https://msberends.github.io/AMR/reference
|
||||
article: https://msberends.github.io/AMR/articles
|
||||
|
@ -82,7 +82,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.9026</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -315,7 +315,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
<span class='co'># same:</span>
|
||||
<span class='fu'>age_groups</span>(<span class='kw'>ages</span>, <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='fl'>1</span>, <span class='fl'>2</span>, <span class='fl'>4</span>, <span class='fl'>6</span>, <span class='fl'>13</span>, <span class='fl'>17</span>))
|
||||
|
||||
<span class='co'>if</span> (<span class='fl'>FALSE</span>) {
|
||||
<span class='co'># \donttest{</span>
|
||||
<span class='co'># resistance of ciprofloxacine per age group</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='kw'>example_isolates</span> <span class='op'>%>%</span>
|
||||
@ -324,7 +324,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(age_group = <span class='fu'>age_groups</span>(<span class='kw'>age</span>)) <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='kw'>age_group</span>, <span class='kw'>CIP</span>) <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='ggplot_rsi.html'>ggplot_rsi</a></span>(x = <span class='st'>"age_group"</span>, minimum = <span class='fl'>0</span>)
|
||||
}
|
||||
<span class='co'># }</span>
|
||||
</pre>
|
||||
</div>
|
||||
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
|
||||
|
@ -50,7 +50,7 @@
|
||||
|
||||
<meta property="og:title" content="Antibiotic class selectors — antibiotic_class_selectors" />
|
||||
<meta property="og:description" content="Use these selection helpers inside any function that allows Tidyverse selection helpers, like dplyr::select() or tidyr::pivot_longer(). They help to select the columns of antibiotics that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations." />
|
||||
<meta property="og:image" content="https://msberends.github.io/AMR/logo.svg" />
|
||||
<meta property="og:image" content="https://msberends.github.io/AMR/logo.png" />
|
||||
|
||||
|
||||
|
||||
@ -82,7 +82,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.9015</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -298,8 +298,7 @@
|
||||
<div class='dont-index'><p><code><a href='filter_ab_class.html'>filter_ab_class()</a></code> for the <code><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter()</a></code> equivalent.</p></div>
|
||||
|
||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||
<pre class="examples"><span class='co'>if</span> (<span class='fl'>FALSE</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>)
|
||||
<pre class="examples"><span class='co'>if</span> (<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='st'><a href='https://dplyr.tidyverse.org'>"dplyr"</a></span>)) {
|
||||
|
||||
<span class='co'># this will select columns 'IPM' (imipenem) and 'MEM' (meropenem):</span>
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span>
|
||||
@ -322,11 +321,12 @@
|
||||
<span class='fu'><a href='https://rdrr.io/r/base/format.html'>format</a></span>()
|
||||
|
||||
|
||||
<span class='fu'><a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a></span>(irrelevant = <span class='st'>"value"</span>,
|
||||
<span class='fu'><a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a></span>(some_column = <span class='st'>"some_value"</span>,
|
||||
J01CA01 = <span class='st'>"S"</span>) <span class='op'>%>%</span> <span class='co'># ATC code of ampicillin</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='fu'>penicillins</span>()) <span class='co'># the 'J01CA01' column will be selected</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='fu'>penicillins</span>()) <span class='co'># only the 'J01CA01' column will be selected</span>
|
||||
|
||||
}</pre>
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
|
||||
<nav id="toc" data-toggle="toc" class="sticky-top">
|
||||
|
@ -82,7 +82,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.9026</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -282,7 +282,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
<div class='dont-index'><p><code><a href='as.rsi.html'>as.rsi()</a></code></p></div>
|
||||
|
||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||
<pre class="examples"><span class='co'>if</span> (<span class='fl'>FALSE</span>) {
|
||||
<pre class="examples"><span class='co'># \donttest{</span>
|
||||
<span class='co'># transform existing disk zones to the `disk` class</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='kw'>df</span> <span class='op'><-</span> <span class='fu'><a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a></span>(microorganism = <span class='st'>"E. coli"</span>,
|
||||
@ -290,8 +290,9 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
CIP = <span class='fl'>14</span>,
|
||||
GEN = <span class='fl'>18</span>,
|
||||
TOB = <span class='fl'>16</span>)
|
||||
<span class='kw'>df</span> <span class='op'><-</span> <span class='kw'>df</span> <span class='op'>%>%</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='kw'>AMP</span><span class='op'>:</span><span class='kw'>TOB</span>), <span class='kw'>as.disk</span>)
|
||||
<span class='kw'>df</span>
|
||||
<span class='kw'>df</span>[, <span class='fl'>2</span><span class='op'>:</span><span class='fl'>5</span>] <span class='op'><-</span> <span class='fu'><a href='https://rdrr.io/r/base/lapply.html'>lapply</a></span>(<span class='kw'>df</span>[, <span class='fl'>2</span><span class='op'>:</span><span class='fl'>5</span>], <span class='kw'>as.disk</span>)
|
||||
<span class='co'># same with dplyr:</span>
|
||||
<span class='co'># df %>% mutate(across(AMP:TOB, as.disk))</span>
|
||||
|
||||
<span class='co'># interpret disk values, see ?as.rsi</span>
|
||||
<span class='fu'><a href='as.rsi.html'>as.rsi</a></span>(x = <span class='fu'>as.disk</span>(<span class='fl'>18</span>),
|
||||
@ -300,7 +301,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
guideline = <span class='st'>"EUCAST"</span>)
|
||||
|
||||
<span class='fu'><a href='as.rsi.html'>as.rsi</a></span>(<span class='kw'>df</span>)
|
||||
}
|
||||
<span class='co'># }</span>
|
||||
</pre>
|
||||
</div>
|
||||
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
|
||||
|
@ -82,7 +82,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.9034</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -361,10 +361,7 @@
|
||||
<h3>Microbial prevalence of pathogens in humans</h3>
|
||||
|
||||
|
||||
<p>The intelligent rules consider the prevalence of microorganisms in humans grouped into three groups, which is available as the <code>prevalence</code> columns in the <a href='microorganisms.html'>microorganisms</a> and <a href='microorganisms.old.html'>microorganisms.old</a> data sets. The grouping into prevalence groups is based on experience from several microbiological laboratories in the Netherlands in conjunction with international reports on pathogen prevalence.</p>
|
||||
<p>Group 1 (most prevalent microorganisms) consists of all microorganisms where the taxonomic class is Gammaproteobacteria or where the taxonomic genus is <em>Enterococcus</em>, <em>Staphylococcus</em> or <em>Streptococcus</em>. This group consequently contains all common Gram-negative bacteria, such as <em>Klebsiella</em>, <em>Pseudomonas</em> and <em>Legionella</em>.</p>
|
||||
<p>Group 2 consists of all microorganisms where the taxonomic phylum is Proteobacteria, Firmicutes, Actinobacteria or Sarcomastigophora, or where the taxonomic genus is <em>Aspergillus</em>, <em>Bacteroides</em>, <em>Candida</em>, <em>Capnocytophaga</em>, <em>Chryseobacterium</em>, <em>Cryptococcus</em>, <em>Elisabethkingia</em>, <em>Flavobacterium</em>, <em>Fusobacterium</em>, <em>Giardia</em>, <em>Leptotrichia</em>, <em>Mycoplasma</em>, <em>Prevotella</em>, <em>Rhodotorula</em>, <em>Treponema</em>, <em>Trichophyton</em> or <em>Ureaplasma</em>. This group consequently contains all less common and rare human pathogens.</p>
|
||||
<p>Group 3 (least prevalent microorganisms) consists of all other microorganisms. This group contains microorganisms most probably not found in humans.</p>
|
||||
<p>The intelligent rules consider the prevalence of microorganisms in humans grouped into three groups, which is available as the <code>prevalence</code> columns in the <a href='microorganisms.html'>microorganisms</a> and <a href='microorganisms.old.html'>microorganisms.old</a> data sets. The grouping into human pathogenic prevalence is explained in the section <em>Matching score for microorganisms</em> below.</p>
|
||||
|
||||
<h2 class="hasAnchor" id="source"><a class="anchor" href="#source"></a>Source</h2>
|
||||
|
||||
@ -392,15 +389,15 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
<p>$$m_{(x, n)} = \frac{l_{n} - 0.5 \cdot \min \begin{cases}l_{n} \\ \operatorname{lev}(x, n)\end{cases}}{l_{n} \cdot p_{n} \cdot k_{n}}$$</p>
|
||||
<p>where:</p><ul>
|
||||
<li><p>\(x\) is the user input;</p></li>
|
||||
<li><p>\(n\) is a taxonomic name (genus, species and subspecies) as found in <code><a href='microorganisms.html'>microorganisms$fullname</a></code>;</p></li>
|
||||
<li><p>\(l_{n}\) is the length of \(n\);</p></li>
|
||||
<li><p>\(\operatorname{lev}\) is the <a href='https://en.wikipedia.org/wiki/Levenshtein_distance'>Levenshtein distance function</a>;</p></li>
|
||||
<li><p>\(p_{n}\) is the human pathogenic prevalence of \(n\), categorised into group \(1\), \(2\) and \(3\) (see <em>Details</em> in <code>?as.mo</code>), meaning that \(p = \{1, 2 , 3\}\);</p></li>
|
||||
<li><p>\(k_{n}\) is the kingdom index of \(n\), set as follows: Bacteria = \(1\), Fungi = \(2\), Protozoa = \(3\), Archaea = \(4\), and all others = \(5\), meaning that \(k = \{1, 2 , 3, 4, 5\}\).</p></li>
|
||||
<li><p>\(n\) is a taxonomic name (genus, species, and subspecies);</p></li>
|
||||
<li><p>\(l_n\) is the length of \(n\);</p></li>
|
||||
<li><p>lev is the <a href='https://en.wikipedia.org/wiki/Levenshtein_distance'>Levenshtein distance function</a>, which counts any insertion, deletion and substitution as 1 that is needed to change \(x\) into \(n\);</p></li>
|
||||
<li><p>\(p_n\) is the human pathogenic prevalence group of \(n\), as described below;</p></li>
|
||||
<li><p>\(k_n\) is the taxonomic kingdom of \(n\), set as Bacteria = 1, Fungi = 2, Protozoa = 3, Archaea = 4, others = 5.</p></li>
|
||||
</ul>
|
||||
|
||||
<p>This means that the user input <code>x = "E. coli"</code> gets for <em>Escherichia coli</em> a matching score of 68.8% and for <em>Entamoeba coli</em> a matching score of 7.9%.</p>
|
||||
<p>All matches are sorted descending on their matching score and for all user input values, the top match will be returned.</p>
|
||||
<p>The grouping into human pathogenic prevalence (\(p\)) is based on experience from several microbiological laboratories in the Netherlands in conjunction with international reports on pathogen prevalence. <strong>Group 1</strong> (most prevalent microorganisms) consists of all microorganisms where the taxonomic class is Gammaproteobacteria or where the taxonomic genus is <em>Enterococcus</em>, <em>Staphylococcus</em> or <em>Streptococcus</em>. This group consequently contains all common Gram-negative bacteria, such as <em>Pseudomonas</em> and <em>Legionella</em> and all species within the order Enterobacterales. <strong>Group 2</strong> consists of all microorganisms where the taxonomic phylum is Proteobacteria, Firmicutes, Actinobacteria or Sarcomastigophora, or where the taxonomic genus is <em>Absidia</em>, <em>Acremonium</em>, <em>Actinotignum</em>, <em>Alternaria</em>, <em>Anaerosalibacter</em>, <em>Apophysomyces</em>, <em>Arachnia</em>, <em>Aspergillus</em>, <em>Aureobacterium</em>, <em>Aureobasidium</em>, <em>Bacteroides</em>, <em>Basidiobolus</em>, <em>Beauveria</em>, <em>Blastocystis</em>, <em>Branhamella</em>, <em>Calymmatobacterium</em>, <em>Candida</em>, <em>Capnocytophaga</em>, <em>Catabacter</em>, <em>Chaetomium</em>, <em>Chryseobacterium</em>, <em>Chryseomonas</em>, <em>Chrysonilia</em>, <em>Cladophialophora</em>, <em>Cladosporium</em>, <em>Conidiobolus</em>, <em>Cryptococcus</em>, <em>Curvularia</em>, <em>Exophiala</em>, <em>Exserohilum</em>, <em>Flavobacterium</em>, <em>Fonsecaea</em>, <em>Fusarium</em>, <em>Fusobacterium</em>, <em>Hendersonula</em>, <em>Hypomyces</em>, <em>Koserella</em>, <em>Lelliottia</em>, <em>Leptosphaeria</em>, <em>Leptotrichia</em>, <em>Malassezia</em>, <em>Malbranchea</em>, <em>Mortierella</em>, <em>Mucor</em>, <em>Mycocentrospora</em>, <em>Mycoplasma</em>, <em>Nectria</em>, <em>Ochroconis</em>, <em>Oidiodendron</em>, <em>Phoma</em>, <em>Piedraia</em>, <em>Pithomyces</em>, <em>Pityrosporum</em>, <em>Prevotella</em>,\<em>Pseudallescheria</em>, <em>Rhizomucor</em>, <em>Rhizopus</em>, <em>Rhodotorula</em>, <em>Scolecobasidium</em>, <em>Scopulariopsis</em>, <em>Scytalidium</em>,<em>Sporobolomyces</em>, <em>Stachybotrys</em>, <em>Stomatococcus</em>, <em>Treponema</em>, <em>Trichoderma</em>, <em>Trichophyton</em>, <em>Trichosporon</em>, <em>Tritirachium</em> or <em>Ureaplasma</em>. <strong>Group 3</strong> consists of all other microorganisms.</p>
|
||||
<p>All matches are sorted descending on their matching score and for all user input values, the top match will be returned. This will lead to the effect that e.g., <code>"E. coli"</code> will return the microbial ID of <em>Escherichia coli</em> (\(m = 0.688\), a highly prevalent microorganism found in humans) and not <em>Entamoeba coli</em> (\(m = 0.079\), a less prevalent microorganism in humans), although the latter would alphabetically come first.</p>
|
||||
<h2 class="hasAnchor" id="catalogue-of-life"><a class="anchor" href="#catalogue-of-life"></a>Catalogue of Life</h2>
|
||||
|
||||
|
||||
@ -459,26 +456,7 @@ This package contains the complete taxonomic tree of almost all microorganisms (
|
||||
<span class='co'># All mo_* functions use as.mo() internally too (see ?mo_property):</span>
|
||||
<span class='fu'><a href='mo_property.html'>mo_genus</a></span>(<span class='st'>"E. coli"</span>) <span class='co'># returns "Escherichia"</span>
|
||||
<span class='fu'><a href='mo_property.html'>mo_gramstain</a></span>(<span class='st'>"E. coli"</span>) <span class='co'># returns "Gram negative"</span>
|
||||
|
||||
<span class='co'># }</span>
|
||||
<span class='co'>if</span> (<span class='fl'>FALSE</span>) {
|
||||
<span class='kw'>df</span><span class='op'>$</span><span class='kw'>mo</span> <span class='op'><-</span> <span class='fu'>as.mo</span>(<span class='kw'>df</span><span class='op'>$</span><span class='kw'>microorganism_name</span>)
|
||||
|
||||
<span class='co'># the select function of the Tidyverse is also supported:</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='kw'>df</span><span class='op'>$</span><span class='kw'>mo</span> <span class='op'><-</span> <span class='kw'>df</span> <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='kw'>microorganism_name</span>) <span class='op'>%>%</span>
|
||||
<span class='fu'>as.mo</span>()
|
||||
|
||||
<span class='co'># and can even contain 2 columns, which is convenient</span>
|
||||
<span class='co'># for genus/species combinations:</span>
|
||||
<span class='kw'>df</span><span class='op'>$</span><span class='kw'>mo</span> <span class='op'><-</span> <span class='kw'>df</span> <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='kw'>genus</span>, <span class='kw'>species</span>) <span class='op'>%>%</span>
|
||||
<span class='fu'>as.mo</span>()
|
||||
<span class='co'># although this works easier and does the same:</span>
|
||||
<span class='kw'>df</span> <span class='op'><-</span> <span class='kw'>df</span> <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(mo = <span class='fu'>as.mo</span>(<span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span>(<span class='kw'>genus</span>, <span class='kw'>species</span>)))
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
|
||||
|
@ -82,7 +82,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.9032</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -424,34 +424,6 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
NIT = <span class='fu'><a href='as.mic.html'>as.mic</a></span>(<span class='fl'>32</span>))
|
||||
<span class='fu'>as.rsi</span>(<span class='kw'>df</span>)
|
||||
|
||||
<span class='co'>if</span> (<span class='fl'>FALSE</span>) {
|
||||
|
||||
<span class='co'># the dplyr way</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='kw'>df</span> <span class='op'>%>%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate_all.html'>mutate_if</a></span>(<span class='kw'>is.mic</span>, <span class='kw'>as.rsi</span>)
|
||||
<span class='kw'>df</span> <span class='op'>%>%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate_all.html'>mutate_if</a></span>(<span class='fu'>function</span>(<span class='kw'>x</span>) <span class='fu'><a href='as.mic.html'>is.mic</a></span>(<span class='kw'>x</span>) <span class='op'>|</span> <span class='fu'><a href='as.disk.html'>is.disk</a></span>(<span class='kw'>x</span>), <span class='kw'>as.rsi</span>)
|
||||
<span class='kw'>df</span> <span class='op'>%>%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='fu'><a href='https://dplyr.tidyverse.org/reference/across.html'>across</a></span>(<span class='fu'>where</span>(<span class='kw'>is.mic</span>), <span class='kw'>as.rsi</span>))
|
||||
<span class='kw'>df</span> <span class='op'>%>%</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='kw'>AMP</span><span class='op'>:</span><span class='kw'>TOB</span>), <span class='kw'>as.rsi</span>)
|
||||
<span class='kw'>df</span> <span class='op'>%>%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='fu'><a href='https://dplyr.tidyverse.org/reference/across.html'>across</a></span>(<span class='kw'>AMP</span><span class='op'>:</span><span class='kw'>TOB</span>), <span class='kw'>as.rsi</span>)
|
||||
|
||||
<span class='kw'>df</span> <span class='op'>%>%</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='kw'>AMP</span><span class='op'>:</span><span class='kw'>TOB</span>), <span class='kw'>as.rsi</span>, mo = <span class='st'>"E. coli"</span>)
|
||||
|
||||
<span class='co'># to include information about urinary tract infections (UTI)</span>
|
||||
<span class='fu'><a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a></span>(mo = <span class='st'>"E. coli"</span>,
|
||||
NIT = <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"<= 2"</span>, <span class='fl'>32</span>),
|
||||
from_the_bladder = <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='fl'>TRUE</span>, <span class='fl'>FALSE</span>)) <span class='op'>%>%</span>
|
||||
<span class='fu'>as.rsi</span>(uti = <span class='st'>"from_the_bladder"</span>)
|
||||
|
||||
<span class='fu'><a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a></span>(mo = <span class='st'>"E. coli"</span>,
|
||||
NIT = <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"<= 2"</span>, <span class='fl'>32</span>),
|
||||
specimen = <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"urine"</span>, <span class='st'>"blood"</span>)) <span class='op'>%>%</span>
|
||||
<span class='fu'>as.rsi</span>() <span class='co'># automatically determines urine isolates</span>
|
||||
|
||||
<span class='kw'>df</span> <span class='op'>%>%</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='kw'>AMP</span><span class='op'>:</span><span class='kw'>NIT</span>), <span class='kw'>as.rsi</span>, mo = <span class='st'>"E. coli"</span>, uti = <span class='fl'>TRUE</span>)
|
||||
}
|
||||
|
||||
<span class='co'># for single values</span>
|
||||
<span class='fu'>as.rsi</span>(x = <span class='fu'><a href='as.mic.html'>as.mic</a></span>(<span class='fl'>2</span>),
|
||||
mo = <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='st'>"S. pneumoniae"</span>),
|
||||
@ -463,6 +435,32 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
ab = <span class='st'>"ampicillin"</span>, <span class='co'># and `ab` with as.ab()</span>
|
||||
guideline = <span class='st'>"EUCAST"</span>)
|
||||
|
||||
<span class='co'># \donttest{</span>
|
||||
<span class='co'># the dplyr way</span>
|
||||
<span class='co'>if</span> (<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='st'><a href='https://dplyr.tidyverse.org'>"dplyr"</a></span>)) {
|
||||
<span class='kw'>df</span> <span class='op'>%>%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate_all.html'>mutate_if</a></span>(<span class='kw'>is.mic</span>, <span class='kw'>as.rsi</span>)
|
||||
<span class='kw'>df</span> <span class='op'>%>%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate_all.html'>mutate_if</a></span>(<span class='fu'>function</span>(<span class='kw'>x</span>) <span class='fu'><a href='as.mic.html'>is.mic</a></span>(<span class='kw'>x</span>) <span class='op'>|</span> <span class='fu'><a href='as.disk.html'>is.disk</a></span>(<span class='kw'>x</span>), <span class='kw'>as.rsi</span>)
|
||||
<span class='kw'>df</span> <span class='op'>%>%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='fu'><a href='https://dplyr.tidyverse.org/reference/across.html'>across</a></span>(<span class='fu'>where</span>(<span class='kw'>is.mic</span>), <span class='kw'>as.rsi</span>))
|
||||
<span class='kw'>df</span> <span class='op'>%>%</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='kw'>AMP</span><span class='op'>:</span><span class='kw'>TOB</span>), <span class='kw'>as.rsi</span>)
|
||||
<span class='kw'>df</span> <span class='op'>%>%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='fu'><a href='https://dplyr.tidyverse.org/reference/across.html'>across</a></span>(<span class='kw'>AMP</span><span class='op'>:</span><span class='kw'>TOB</span>), <span class='kw'>as.rsi</span>)
|
||||
|
||||
<span class='kw'>df</span> <span class='op'>%>%</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='kw'>AMP</span><span class='op'>:</span><span class='kw'>TOB</span>), <span class='kw'>as.rsi</span>, mo = <span class='st'>"E. coli"</span>)
|
||||
|
||||
<span class='co'># to include information about urinary tract infections (UTI)</span>
|
||||
<span class='fu'><a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a></span>(mo = <span class='st'>"E. coli"</span>,
|
||||
NIT = <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"<= 2"</span>, <span class='fl'>32</span>),
|
||||
from_the_bladder = <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='fl'>TRUE</span>, <span class='fl'>FALSE</span>)) <span class='op'>%>%</span>
|
||||
<span class='fu'>as.rsi</span>(uti = <span class='st'>"from_the_bladder"</span>)
|
||||
|
||||
<span class='fu'><a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a></span>(mo = <span class='st'>"E. coli"</span>,
|
||||
NIT = <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"<= 2"</span>, <span class='fl'>32</span>),
|
||||
specimen = <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"urine"</span>, <span class='st'>"blood"</span>)) <span class='op'>%>%</span>
|
||||
<span class='fu'>as.rsi</span>() <span class='co'># automatically determines urine isolates</span>
|
||||
|
||||
<span class='kw'>df</span> <span class='op'>%>%</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='kw'>AMP</span><span class='op'>:</span><span class='kw'>NIT</span>), <span class='kw'>as.rsi</span>, mo = <span class='st'>"E. coli"</span>, uti = <span class='fl'>TRUE</span>)
|
||||
}
|
||||
|
||||
<span class='co'># For CLEANING existing R/SI values ------------------------------------</span>
|
||||
|
||||
@ -473,26 +471,23 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
<span class='fu'><a href='plot.html'>plot</a></span>(<span class='kw'>rsi_data</span>) <span class='co'># for percentages</span>
|
||||
<span class='fu'><a href='https://rdrr.io/r/graphics/barplot.html'>barplot</a></span>(<span class='kw'>rsi_data</span>) <span class='co'># for frequencies</span>
|
||||
|
||||
<span class='co'>if</span> (<span class='fl'>FALSE</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='kw'>example_isolates</span> <span class='op'>%>%</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='kw'>PEN</span><span class='op'>:</span><span class='kw'>RIF</span>), <span class='kw'>as.rsi</span>)
|
||||
<span class='co'># same: </span>
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span>
|
||||
<span class='fu'>as.rsi</span>(<span class='kw'>PEN</span><span class='op'>:</span><span class='kw'>RIF</span>)
|
||||
|
||||
<span class='co'># fastest way to transform all columns with already valid AMR results to class `rsi`:</span>
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate_all.html'>mutate_if</a></span>(<span class='kw'>is.rsi.eligible</span>, <span class='kw'>as.rsi</span>)
|
||||
|
||||
<span class='co'># note: from dplyr 1.0.0 on, this will be: </span>
|
||||
<span class='co'># example_isolates %>%</span>
|
||||
<span class='co'># mutate(across(is.rsi.eligible, as.rsi))</span>
|
||||
|
||||
<span class='co'># default threshold of `is.rsi.eligible` is 5%.</span>
|
||||
<span class='fu'>is.rsi.eligible</span>(<span class='kw'>WHONET</span><span class='op'>$</span><span class='kw'>`First name`</span>) <span class='co'># fails, >80% is invalid</span>
|
||||
<span class='fu'>is.rsi.eligible</span>(<span class='kw'>WHONET</span><span class='op'>$</span><span class='kw'>`First name`</span>, threshold = <span class='fl'>0.99</span>) <span class='co'># succeeds</span>
|
||||
<span class='co'># the dplyr way</span>
|
||||
<span class='co'>if</span> (<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='st'><a href='https://dplyr.tidyverse.org'>"dplyr"</a></span>)) {
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</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='kw'>PEN</span><span class='op'>:</span><span class='kw'>RIF</span>), <span class='kw'>as.rsi</span>)
|
||||
<span class='co'># same: </span>
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span>
|
||||
<span class='fu'>as.rsi</span>(<span class='kw'>PEN</span><span class='op'>:</span><span class='kw'>RIF</span>)
|
||||
|
||||
<span class='co'># fastest way to transform all columns with already valid AMR results to class `rsi`:</span>
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate_all.html'>mutate_if</a></span>(<span class='kw'>is.rsi.eligible</span>, <span class='kw'>as.rsi</span>)
|
||||
|
||||
<span class='co'># note: from dplyr 1.0.0 on, this will be: </span>
|
||||
<span class='co'># example_isolates %>%</span>
|
||||
<span class='co'># mutate(across(is.rsi.eligible, as.rsi))</span>
|
||||
}
|
||||
<span class='co'># }</span>
|
||||
</pre>
|
||||
</div>
|
||||
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
|
||||
|
@ -82,7 +82,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.9026</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -327,18 +327,15 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
<p>On our website <a href='https://msberends.github.io/AMR'>https://msberends.github.io/AMR</a> you can find <a href='https://msberends.github.io/AMR/articles/AMR.html'>a comprehensive tutorial</a> about how to conduct AMR analysis, the <a href='https://msberends.github.io/AMR/reference'>complete documentation of all functions</a> (which reads a lot easier than here in R) and <a href='https://msberends.github.io/AMR/articles/WHONET.html'>an example analysis using WHONET data</a>. As we would like to better understand the backgrounds and needs of our users, please <a href='https://msberends.github.io/AMR/survey.html'>participate in our survey</a>!</p>
|
||||
|
||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||
<pre class="examples"><span class='co'>if</span> (<span class='fl'>FALSE</span>) {
|
||||
<pre class="examples"><span class='co'># \donttest{</span>
|
||||
<span class='co'># oral DDD (Defined Daily Dose) of amoxicillin</span>
|
||||
<span class='fu'>atc_online_property</span>(<span class='st'>"J01CA04"</span>, <span class='st'>"DDD"</span>, <span class='st'>"O"</span>)
|
||||
|
||||
<span class='co'># parenteral DDD (Defined Daily Dose) of amoxicillin</span>
|
||||
<span class='fu'>atc_online_property</span>(<span class='st'>"J01CA04"</span>, <span class='st'>"DDD"</span>, <span class='st'>"P"</span>)
|
||||
|
||||
<span class='fu'>atc_online_property</span>(<span class='st'>"J01CA04"</span>, property = <span class='st'>"groups"</span>) <span class='co'># search hierarchical groups of amoxicillin</span>
|
||||
<span class='co'># [1] "ANTIINFECTIVES FOR SYSTEMIC USE"</span>
|
||||
<span class='co'># [2] "ANTIBACTERIALS FOR SYSTEMIC USE"</span>
|
||||
<span class='co'># [3] "BETA-LACTAM ANTIBACTERIALS, PENICILLINS"</span>
|
||||
<span class='co'># [4] "Penicillins with extended spectrum"</span>
|
||||
}
|
||||
<span class='co'># }</span>
|
||||
</pre>
|
||||
</div>
|
||||
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
|
||||
|
@ -82,7 +82,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.9026</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -279,18 +279,11 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||
<pre class="examples"><span class='fu'>availability</span>(<span class='kw'>example_isolates</span>)
|
||||
|
||||
<span class='co'>if</span> (<span class='fl'>FALSE</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='kw'>example_isolates</span> <span class='op'>%>%</span> <span class='fu'>availability</span>()
|
||||
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select_all.html'>select_if</a></span>(<span class='kw'>is.rsi</span>) <span class='op'>%>%</span>
|
||||
<span class='fu'>availability</span>()
|
||||
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='kw'>mo</span> <span class='op'>==</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='st'>"E. coli"</span>)) <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select_all.html'>select_if</a></span>(<span class='kw'>is.rsi</span>) <span class='op'>%>%</span>
|
||||
<span class='fu'>availability</span>()
|
||||
<span class='co'>if</span> (<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='st'><a href='https://dplyr.tidyverse.org'>"dplyr"</a></span>)) {
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='kw'>mo</span> <span class='op'>==</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='st'>"E. coli"</span>)) <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select_all.html'>select_if</a></span>(<span class='kw'>is.rsi</span>) <span class='op'>%>%</span>
|
||||
<span class='fu'>availability</span>()
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
@ -82,7 +82,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.9028</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -304,7 +304,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th>remove_intrinsic_resistant</th>
|
||||
<td><p>logical to indicate that rows with 100% resistance for all tested antimicrobials must be removed from the table</p></td>
|
||||
<td><p>logical to indicate that rows and columns with 100% resistance for all tested antimicrobials must be removed from the table</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>decimal.mark</th>
|
||||
@ -348,13 +348,13 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
<span class='fu'><a href='https://rdrr.io/r/base/format.html'>format</a></span>(<span class='kw'>x</span>, translate_ab = <span class='st'>"name (atc)"</span>)
|
||||
|
||||
<span class='co'># Use FUN to change to transformation of microorganism codes</span>
|
||||
<span class='kw'>x</span> <span class='op'><-</span> <span class='fu'>bug_drug_combinations</span>(<span class='kw'>example_isolates</span>,
|
||||
FUN = <span class='kw'>mo_gramstain</span>)
|
||||
<span class='fu'>bug_drug_combinations</span>(<span class='kw'>example_isolates</span>,
|
||||
FUN = <span class='kw'>mo_gramstain</span>)
|
||||
|
||||
<span class='kw'>x</span> <span class='op'><-</span> <span class='fu'>bug_drug_combinations</span>(<span class='kw'>example_isolates</span>,
|
||||
FUN = <span class='fu'>function</span>(<span class='kw'>x</span>) <span class='fu'><a href='https://rdrr.io/r/base/ifelse.html'>ifelse</a></span>(<span class='kw'>x</span> <span class='op'>==</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='st'>"E. coli"</span>),
|
||||
<span class='st'>"E. coli"</span>,
|
||||
<span class='st'>"Others"</span>))
|
||||
<span class='fu'>bug_drug_combinations</span>(<span class='kw'>example_isolates</span>,
|
||||
FUN = <span class='fu'>function</span>(<span class='kw'>x</span>) <span class='fu'><a href='https://rdrr.io/r/base/ifelse.html'>ifelse</a></span>(<span class='kw'>x</span> <span class='op'>==</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='st'>"E. coli"</span>),
|
||||
<span class='st'>"E. coli"</span>,
|
||||
<span class='st'>"Others"</span>))
|
||||
<span class='co'># }</span>
|
||||
</pre>
|
||||
</div>
|
||||
|
File diff suppressed because one or more lines are too long
BIN
docs/reference/figures/mo_matching_score.png
Normal file
BIN
docs/reference/figures/mo_matching_score.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
@ -50,7 +50,7 @@
|
||||
|
||||
<meta property="og:title" content="Filter isolates on result in antimicrobial class — filter_ab_class" />
|
||||
<meta property="og:description" content="Filter isolates on results in specific antimicrobial classes. This makes it easy to filter on isolates that were tested for e.g. any aminoglycoside, or to filter on carbapenem-resistant isolates without the need to specify the drugs." />
|
||||
<meta property="og:image" content="https://msberends.github.io/AMR/logo.svg" />
|
||||
<meta property="og:image" content="https://msberends.github.io/AMR/logo.png" />
|
||||
|
||||
|
||||
|
||||
@ -82,7 +82,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.9015</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -310,41 +310,45 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
<div class='dont-index'><p><code><a href='antibiotic_class_selectors.html'>antibiotic_class_selectors()</a></code> for the <code><a href='https://dplyr.tidyverse.org/reference/select.html'>select()</a></code> equivalent.</p></div>
|
||||
|
||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||
<pre class="examples"><span class='co'>if</span> (<span class='fl'>FALSE</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>)
|
||||
<pre class="examples"><span class='fu'>filter_aminoglycosides</span>(<span class='kw'>example_isolates</span>)
|
||||
|
||||
<span class='co'># filter on isolates that have any result for any aminoglycoside</span>
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span> <span class='fu'>filter_ab_class</span>(<span class='st'>"aminoglycoside"</span>)
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span> <span class='fu'>filter_aminoglycosides</span>()
|
||||
<span class='co'># \donttest{</span>
|
||||
<span class='co'>if</span> (<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='st'><a href='https://dplyr.tidyverse.org'>"dplyr"</a></span>)) {
|
||||
|
||||
<span class='co'># this is essentially the same as (but without determination of column names):</span>
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter_all.html'>filter_at</a></span>(.vars = <span class='fu'><a href='https://dplyr.tidyverse.org/reference/vars.html'>vars</a></span>(<span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"GEN"</span>, <span class='st'>"TOB"</span>, <span class='st'>"AMK"</span>, <span class='st'>"KAN"</span>)),
|
||||
.vars_predicate = <span class='fu'><a href='https://dplyr.tidyverse.org/reference/all_vars.html'>any_vars</a></span>(<span class='kw'>.</span> <span class='op'>%in%</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='co'># filter on isolates that have any result for any aminoglycoside</span>
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span> <span class='fu'>filter_aminoglycosides</span>()
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span> <span class='fu'>filter_ab_class</span>(<span class='st'>"aminoglycoside"</span>)
|
||||
|
||||
<span class='co'># this is essentially the same as (but without determination of column names):</span>
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter_all.html'>filter_at</a></span>(.vars = <span class='fu'><a href='https://dplyr.tidyverse.org/reference/vars.html'>vars</a></span>(<span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"GEN"</span>, <span class='st'>"TOB"</span>, <span class='st'>"AMK"</span>, <span class='st'>"KAN"</span>)),
|
||||
.vars_predicate = <span class='fu'><a href='https://dplyr.tidyverse.org/reference/all_vars.html'>any_vars</a></span>(<span class='kw'>.</span> <span class='op'>%in%</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='co'># filter on isolates that show resistance to ANY aminoglycoside</span>
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span> <span class='fu'>filter_aminoglycosides</span>(<span class='st'>"R"</span>, <span class='st'>"any"</span>)
|
||||
|
||||
<span class='co'># filter on isolates that show resistance to ALL aminoglycosides</span>
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span> <span class='fu'>filter_aminoglycosides</span>(<span class='st'>"R"</span>, <span class='st'>"all"</span>)
|
||||
|
||||
<span class='co'># filter on isolates that show resistance to</span>
|
||||
<span class='co'># any aminoglycoside and any fluoroquinolone</span>
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span>
|
||||
<span class='fu'>filter_aminoglycosides</span>(<span class='st'>"R"</span>) <span class='op'>%>%</span>
|
||||
<span class='fu'>filter_fluoroquinolones</span>(<span class='st'>"R"</span>)
|
||||
|
||||
<span class='co'># filter on isolates that show resistance to</span>
|
||||
<span class='co'># all aminoglycosides and all fluoroquinolones</span>
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span>
|
||||
<span class='fu'>filter_aminoglycosides</span>(<span class='st'>"R"</span>, <span class='st'>"all"</span>) <span class='op'>%>%</span>
|
||||
<span class='fu'>filter_fluoroquinolones</span>(<span class='st'>"R"</span>, <span class='st'>"all"</span>)
|
||||
|
||||
<span class='co'># with dplyr 1.0.0 and higher (that adds 'across()'), this is equal:</span>
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span> <span class='fu'>filter_carbapenems</span>(<span class='st'>"R"</span>, <span class='st'>"all"</span>)
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='fu'><a href='https://dplyr.tidyverse.org/reference/across.html'>across</a></span>(<span class='fu'><a href='antibiotic_class_selectors.html'>carbapenems</a></span>(), <span class='op'>~</span><span class='kw'>.</span> <span class='op'>==</span> <span class='st'>"R"</span>))
|
||||
}</pre>
|
||||
<span class='co'># filter on isolates that show resistance to ANY aminoglycoside</span>
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span> <span class='fu'>filter_aminoglycosides</span>(<span class='st'>"R"</span>, <span class='st'>"any"</span>)
|
||||
|
||||
<span class='co'># filter on isolates that show resistance to ALL aminoglycosides</span>
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span> <span class='fu'>filter_aminoglycosides</span>(<span class='st'>"R"</span>, <span class='st'>"all"</span>)
|
||||
|
||||
<span class='co'># filter on isolates that show resistance to</span>
|
||||
<span class='co'># any aminoglycoside and any fluoroquinolone</span>
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span>
|
||||
<span class='fu'>filter_aminoglycosides</span>(<span class='st'>"R"</span>) <span class='op'>%>%</span>
|
||||
<span class='fu'>filter_fluoroquinolones</span>(<span class='st'>"R"</span>)
|
||||
|
||||
<span class='co'># filter on isolates that show resistance to</span>
|
||||
<span class='co'># all aminoglycosides and all fluoroquinolones</span>
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span>
|
||||
<span class='fu'>filter_aminoglycosides</span>(<span class='st'>"R"</span>, <span class='st'>"all"</span>) <span class='op'>%>%</span>
|
||||
<span class='fu'>filter_fluoroquinolones</span>(<span class='st'>"R"</span>, <span class='st'>"all"</span>)
|
||||
|
||||
<span class='co'># with dplyr 1.0.0 and higher (that adds 'across()'), this is equal:</span>
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span> <span class='fu'>filter_carbapenems</span>(<span class='st'>"R"</span>, <span class='st'>"all"</span>)
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='fu'><a href='https://dplyr.tidyverse.org/reference/across.html'>across</a></span>(<span class='fu'><a href='antibiotic_class_selectors.html'>carbapenems</a></span>(), <span class='op'>~</span><span class='kw'>.</span> <span class='op'>==</span> <span class='st'>"R"</span>))
|
||||
}
|
||||
<span class='co'># }</span>
|
||||
</pre>
|
||||
</div>
|
||||
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
|
||||
<nav id="toc" data-toggle="toc" class="sticky-top">
|
||||
|
@ -82,7 +82,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.9026</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -369,15 +369,16 @@
|
||||
<p><strong>WHY THIS IS SO IMPORTANT</strong> <br />
|
||||
To conduct an analysis of antimicrobial resistance, you should only include the first isolate of every patient per episode <a href='https://www.ncbi.nlm.nih.gov/pubmed/17304462'>(ref)</a>. If you would not do this, you could easily get an overestimate or underestimate of the resistance of an antibiotic. Imagine that a patient was admitted with an MRSA and that it was found in 5 different blood cultures the following week. The resistance percentage of oxacillin of all <em>S. aureus</em> isolates would be overestimated, because you included this MRSA more than once. It would be <a href='https://en.wikipedia.org/wiki/Selection_bias'>selection bias</a>.</p>
|
||||
<p>All isolates with a microbial ID of <code>NA</code> will be excluded as first isolate.</p>
|
||||
<p>The functions <code>filter_first_isolate()</code> and <code>filter_first_weighted_isolate()</code> are helper functions to quickly filter on first isolates. The function <code>filter_first_isolate()</code> is essentially equal to one of:</p><pre> <span class='kw'>x</span> <span class='op'>%>%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='fu'>first_isolate</span>(<span class='kw'>.</span>, <span class='kw'>...</span>))
|
||||
<p>The functions <code>filter_first_isolate()</code> and <code>filter_first_weighted_isolate()</code> are helper functions to quickly filter on first isolates. The function <code>filter_first_isolate()</code> is essentially equal to either:</p><pre> <span class='kw'>x</span>[<span class='fu'>first_isolate</span>(<span class='kw'>x</span>, <span class='kw'>...</span>), ]
|
||||
<span class='kw'>x</span> <span class='op'>%>%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='fu'>first_isolate</span>(<span class='kw'>x</span>, <span class='kw'>...</span>))
|
||||
</pre>
|
||||
|
||||
<p>The function <code>filter_first_weighted_isolate()</code> is essentially equal to:</p><pre> <span class='kw'>x</span> <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(keyab = <span class='fu'><a href='key_antibiotics.html'>key_antibiotics</a></span>(<span class='kw'>.</span>)) <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(only_weighted_firsts = <span class='fu'>first_isolate</span>(<span class='kw'>x</span>,
|
||||
col_keyantibiotics = <span class='st'>"keyab"</span>, <span class='kw'>...</span>)) <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='kw'>only_weighted_firsts</span> <span class='op'>==</span> <span class='fl'>TRUE</span>) <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='op'>-</span><span class='kw'>only_weighted_firsts</span>, <span class='op'>-</span><span class='kw'>keyab</span>)
|
||||
<p>The function <code>filter_first_weighted_isolate()</code> is essentially equal to:</p><pre> <span class='kw'>x</span> <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(keyab = <span class='fu'><a href='key_antibiotics.html'>key_antibiotics</a></span>(<span class='kw'>.</span>)) <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(only_weighted_firsts = <span class='fu'>first_isolate</span>(<span class='kw'>x</span>,
|
||||
col_keyantibiotics = <span class='st'>"keyab"</span>, <span class='kw'>...</span>)) <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='kw'>only_weighted_firsts</span> <span class='op'>==</span> <span class='fl'>TRUE</span>) <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='op'>-</span><span class='kw'>only_weighted_firsts</span>, <span class='op'>-</span><span class='kw'>keyab</span>)
|
||||
</pre>
|
||||
|
||||
<h2 class="hasAnchor" id="key-antibiotics"><a class="anchor" href="#key-antibiotics"></a>Key antibiotics</h2>
|
||||
@ -411,50 +412,41 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
<pre class="examples"><span class='co'># `example_isolates` is a dataset available in the AMR package.</span>
|
||||
<span class='co'># See ?example_isolates.</span>
|
||||
|
||||
<span class='co'>if</span> (<span class='fl'>FALSE</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='co'># Filter on first isolates:</span>
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(first_isolate = <span class='fu'>first_isolate</span>(<span class='kw'>.</span>)) <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='kw'>first_isolate</span> <span class='op'>==</span> <span class='fl'>TRUE</span>)
|
||||
<span class='co'># basic filtering on first isolates</span>
|
||||
<span class='kw'>example_isolates</span>[<span class='fu'>first_isolate</span>(<span class='kw'>example_isolates</span>), ]
|
||||
|
||||
<span class='co'># Now let's see if first isolates matter:</span>
|
||||
<span class='kw'>A</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>(<span class='kw'>hospital_id</span>) <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(count = <span class='fu'><a href='count.html'>n_rsi</a></span>(<span class='kw'>GEN</span>), <span class='co'># gentamicin availability</span>
|
||||
resistance = <span class='fu'><a href='proportion.html'>resistance</a></span>(<span class='kw'>GEN</span>)) <span class='co'># gentamicin resistance</span>
|
||||
|
||||
<span class='kw'>B</span> <span class='op'><-</span> <span class='kw'>example_isolates</span> <span class='op'>%>%</span>
|
||||
<span class='fu'>filter_first_weighted_isolate</span>() <span class='op'>%>%</span> <span class='co'># the 1st isolate filter</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='kw'>hospital_id</span>) <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(count = <span class='fu'><a href='count.html'>n_rsi</a></span>(<span class='kw'>GEN</span>), <span class='co'># gentamicin availability</span>
|
||||
resistance = <span class='fu'><a href='proportion.html'>resistance</a></span>(<span class='kw'>GEN</span>)) <span class='co'># gentamicin resistance</span>
|
||||
|
||||
<span class='co'># Have a look at A and B.</span>
|
||||
<span class='co'># B is more reliable because every isolate is counted only once.</span>
|
||||
<span class='co'># Gentamicin resistance in hospital D appears to be 3.7% higher than</span>
|
||||
<span class='co'># when you (erroneously) would have used all isolates for analysis.</span>
|
||||
|
||||
|
||||
<span class='co'>## OTHER EXAMPLES:</span>
|
||||
|
||||
<span class='co'># Short-hand versions:</span>
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span>
|
||||
<span class='fu'>filter_first_isolate</span>()
|
||||
<span class='co'># \donttest{</span>
|
||||
<span class='co'>if</span> (<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='st'><a href='https://dplyr.tidyverse.org'>"dplyr"</a></span>)) {
|
||||
<span class='co'># Filter on first isolates:</span>
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(first_isolate = <span class='fu'>first_isolate</span>(<span class='kw'>.</span>)) <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='kw'>first_isolate</span> <span class='op'>==</span> <span class='fl'>TRUE</span>)
|
||||
|
||||
<span class='co'># Short-hand versions:</span>
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span>
|
||||
<span class='fu'>filter_first_isolate</span>()
|
||||
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span>
|
||||
<span class='fu'>filter_first_weighted_isolate</span>()
|
||||
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span>
|
||||
<span class='fu'>filter_first_weighted_isolate</span>()
|
||||
|
||||
|
||||
<span class='co'># set key antibiotics to a new variable</span>
|
||||
<span class='kw'>x</span><span class='op'>$</span><span class='kw'>keyab</span> <span class='op'><-</span> <span class='fu'><a href='key_antibiotics.html'>key_antibiotics</a></span>(<span class='kw'>x</span>)
|
||||
|
||||
<span class='kw'>x</span><span class='op'>$</span><span class='kw'>first_isolate</span> <span class='op'><-</span> <span class='fu'>first_isolate</span>(<span class='kw'>x</span>)
|
||||
|
||||
<span class='kw'>x</span><span class='op'>$</span><span class='kw'>first_isolate_weighed</span> <span class='op'><-</span> <span class='fu'>first_isolate</span>(<span class='kw'>x</span>, col_keyantibiotics = <span class='st'>'keyab'</span>)
|
||||
|
||||
<span class='kw'>x</span><span class='op'>$</span><span class='kw'>first_blood_isolate</span> <span class='op'><-</span> <span class='fu'>first_isolate</span>(<span class='kw'>x</span>, specimen_group = <span class='st'>"Blood"</span>)
|
||||
<span class='co'># Now let's see if first isolates matter:</span>
|
||||
<span class='kw'>A</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>(<span class='kw'>hospital_id</span>) <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(count = <span class='fu'><a href='count.html'>n_rsi</a></span>(<span class='kw'>GEN</span>), <span class='co'># gentamicin availability</span>
|
||||
resistance = <span class='fu'><a href='proportion.html'>resistance</a></span>(<span class='kw'>GEN</span>)) <span class='co'># gentamicin resistance</span>
|
||||
|
||||
<span class='kw'>B</span> <span class='op'><-</span> <span class='kw'>example_isolates</span> <span class='op'>%>%</span>
|
||||
<span class='fu'>filter_first_weighted_isolate</span>() <span class='op'>%>%</span> <span class='co'># the 1st isolate filter</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='kw'>hospital_id</span>) <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(count = <span class='fu'><a href='count.html'>n_rsi</a></span>(<span class='kw'>GEN</span>), <span class='co'># gentamicin availability</span>
|
||||
resistance = <span class='fu'><a href='proportion.html'>resistance</a></span>(<span class='kw'>GEN</span>)) <span class='co'># gentamicin resistance</span>
|
||||
|
||||
<span class='co'># Have a look at A and B.</span>
|
||||
<span class='co'># B is more reliable because every isolate is counted only once.</span>
|
||||
<span class='co'># Gentamicin resistance in hospital D appears to be 3.7% higher than</span>
|
||||
<span class='co'># when you (erroneously) would have used all isolates for analysis.</span>
|
||||
}
|
||||
<span class='co'># }</span>
|
||||
</pre>
|
||||
</div>
|
||||
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
|
||||
|
@ -50,7 +50,7 @@
|
||||
|
||||
<meta property="og:title" content="PCA biplot with ggplot2 — ggplot_pca" />
|
||||
<meta property="og:description" content="Produces a ggplot2 variant of a so-called biplot for PCA (principal component analysis), but is more flexible and more appealing than the base R biplot() function." />
|
||||
<meta property="og:image" content="https://msberends.github.io/AMR/logo.svg" />
|
||||
<meta property="og:image" content="https://msberends.github.io/AMR/logo.png" />
|
||||
|
||||
|
||||
|
||||
@ -82,7 +82,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.9015</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -395,8 +395,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>maturing<
|
||||
<span class='co'># See ?example_isolates.</span>
|
||||
|
||||
<span class='co'># See ?pca for more info about Principal Component Analysis (PCA).</span>
|
||||
<span class='co'>if</span> (<span class='fl'>FALSE</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='co'>if</span> (<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='st'><a href='https://dplyr.tidyverse.org'>"dplyr"</a></span>)) {
|
||||
<span class='kw'>pca_model</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/filter.html'>filter</a></span>(<span class='fu'><a href='mo_property.html'>mo_genus</a></span>(<span class='kw'>mo</span>) <span class='op'>==</span> <span class='st'>"Staphylococcus"</span>) <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(species = <span class='fu'><a href='mo_property.html'>mo_shortname</a></span>(<span class='kw'>mo</span>)) <span class='op'>%>%</span>
|
||||
@ -414,7 +413,8 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>maturing<
|
||||
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/scale_viridis.html'>scale_colour_viridis_d</a></span>() <span class='op'>+</span>
|
||||
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/labs.html'>labs</a></span>(title = <span class='st'>"Title here"</span>)
|
||||
}
|
||||
}</pre>
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
|
||||
<nav id="toc" data-toggle="toc" class="sticky-top">
|
||||
|
@ -82,7 +82,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.9026</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -467,14 +467,14 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>maturing<
|
||||
|
||||
}
|
||||
|
||||
<span class='co'>if</span> (<span class='fl'>FALSE</span>) {
|
||||
<span class='co'># \donttest{</span>
|
||||
|
||||
<span class='co'># resistance of ciprofloxacine per age group</span>
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(first_isolate = <span class='fu'><a href='first_isolate.html'>first_isolate</a></span>(<span class='kw'>.</span>)) <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='kw'>first_isolate</span> <span class='op'>==</span> <span class='fl'>TRUE</span>,
|
||||
<span class='kw'>mo</span> <span class='op'>==</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='st'>"E. coli"</span>)) <span class='op'>%>%</span>
|
||||
<span class='co'># `age_group` is also a function of this package:</span>
|
||||
<span class='co'># `age_groups` is also a function of this AMR package:</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(age_group = <span class='fu'><a href='age_groups.html'>age_groups</a></span>(<span class='kw'>age</span>)) <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='kw'>age_group</span>,
|
||||
<span class='kw'>CIP</span>) <span class='op'>%>%</span>
|
||||
@ -483,7 +483,8 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>maturing<
|
||||
<span class='co'># for colourblind mode, use divergent colours from the viridis package:</span>
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='kw'>AMX</span>, <span class='kw'>NIT</span>, <span class='kw'>FOS</span>, <span class='kw'>TMP</span>, <span class='kw'>CIP</span>) <span class='op'>%>%</span>
|
||||
<span class='fu'>ggplot_rsi</span>() <span class='op'>+</span> <span class='fu'><a href='https://ggplot2.tidyverse.org/reference/scale_viridis.html'>scale_fill_viridis_d</a></span>()
|
||||
<span class='fu'>ggplot_rsi</span>() <span class='op'>+</span>
|
||||
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/scale_viridis.html'>scale_fill_viridis_d</a></span>()
|
||||
<span class='co'># a shorter version which also adjusts data label colours:</span>
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='kw'>AMX</span>, <span class='kw'>NIT</span>, <span class='kw'>FOS</span>, <span class='kw'>TMP</span>, <span class='kw'>CIP</span>) <span class='op'>%>%</span>
|
||||
@ -500,7 +501,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>maturing<
|
||||
title = <span class='st'>"AMR of Anti-UTI Drugs Per Hospital"</span>,
|
||||
x.title = <span class='st'>"Hospital"</span>,
|
||||
datalabels = <span class='fl'>FALSE</span>)
|
||||
}
|
||||
<span class='co'># }</span>
|
||||
</pre>
|
||||
</div>
|
||||
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
|
||||
|
@ -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.9034</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -634,25 +634,6 @@
|
||||
</td>
|
||||
<td><p>Symbol of a p-value</p></td>
|
||||
</tr>
|
||||
</tbody><tbody>
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<h2 id="section-other-deprecated-functions" class="hasAnchor"><a href="#section-other-deprecated-functions" class="anchor"></a>Other: deprecated functions</h2>
|
||||
<p class="section-desc"><p>These functions are deprecated, meaning that they will still work but show a warning with every use and will be removed in a future version.</p></p>
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody><tbody>
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
<p><code><a href="AMR-deprecated.html">portion_R()</a></code> <code><a href="AMR-deprecated.html">portion_IR()</a></code> <code><a href="AMR-deprecated.html">portion_I()</a></code> <code><a href="AMR-deprecated.html">portion_SI()</a></code> <code><a href="AMR-deprecated.html">portion_S()</a></code> <code><a href="AMR-deprecated.html">portion_df()</a></code> </p>
|
||||
</td>
|
||||
<td><p>Deprecated functions</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
@ -82,7 +82,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.9032</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -296,20 +296,23 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
<pre class="examples"><span class='fu'>left_join_microorganisms</span>(<span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='st'>"K. pneumoniae"</span>))
|
||||
<span class='fu'>left_join_microorganisms</span>(<span class='st'>"B_KLBSL_PNE"</span>)
|
||||
|
||||
<span class='co'>if</span> (<span class='fl'>FALSE</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='kw'>example_isolates</span> <span class='op'>%>%</span> <span class='fu'>left_join_microorganisms</span>()
|
||||
|
||||
<span class='kw'>df</span> <span class='op'><-</span> <span class='fu'><a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a></span>(date = <span class='fu'><a href='https://rdrr.io/r/base/seq.html'>seq</a></span>(from = <span class='fu'><a href='https://rdrr.io/r/base/as.Date.html'>as.Date</a></span>(<span class='st'>"2018-01-01"</span>),
|
||||
to = <span class='fu'><a href='https://rdrr.io/r/base/as.Date.html'>as.Date</a></span>(<span class='st'>"2018-01-07"</span>),
|
||||
by = <span class='fl'>1</span>),
|
||||
bacteria = <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"S. aureus"</span>, <span class='st'>"MRSA"</span>, <span class='st'>"MSSA"</span>, <span class='st'>"STAAUR"</span>,
|
||||
<span class='st'>"E. coli"</span>, <span class='st'>"E. coli"</span>, <span class='st'>"E. coli"</span>)),
|
||||
stringsAsFactors = <span class='fl'>FALSE</span>)
|
||||
<span class='fu'><a href='https://rdrr.io/r/base/colnames.html'>colnames</a></span>(<span class='kw'>df</span>)
|
||||
<span class='kw'>df_joined</span> <span class='op'><-</span> <span class='fu'>left_join_microorganisms</span>(<span class='kw'>df</span>, <span class='st'>"bacteria"</span>)
|
||||
<span class='fu'><a href='https://rdrr.io/r/base/colnames.html'>colnames</a></span>(<span class='kw'>df_joined</span>)
|
||||
<span class='co'># \donttest{</span>
|
||||
<span class='co'>if</span> (<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='st'><a href='https://dplyr.tidyverse.org'>"dplyr"</a></span>)) {
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span>
|
||||
<span class='fu'>left_join_microorganisms</span>() <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://rdrr.io/r/base/colnames.html'>colnames</a></span>()
|
||||
|
||||
<span class='kw'>df</span> <span class='op'><-</span> <span class='fu'><a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a></span>(date = <span class='fu'><a href='https://rdrr.io/r/base/seq.html'>seq</a></span>(from = <span class='fu'><a href='https://rdrr.io/r/base/as.Date.html'>as.Date</a></span>(<span class='st'>"2018-01-01"</span>),
|
||||
to = <span class='fu'><a href='https://rdrr.io/r/base/as.Date.html'>as.Date</a></span>(<span class='st'>"2018-01-07"</span>),
|
||||
by = <span class='fl'>1</span>),
|
||||
bacteria = <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"S. aureus"</span>, <span class='st'>"MRSA"</span>, <span class='st'>"MSSA"</span>, <span class='st'>"STAAUR"</span>,
|
||||
<span class='st'>"E. coli"</span>, <span class='st'>"E. coli"</span>, <span class='st'>"E. coli"</span>)),
|
||||
stringsAsFactors = <span class='fl'>FALSE</span>)
|
||||
<span class='fu'><a href='https://rdrr.io/r/base/colnames.html'>colnames</a></span>(<span class='kw'>df</span>)
|
||||
<span class='kw'>df_joined</span> <span class='op'><-</span> <span class='fu'>left_join_microorganisms</span>(<span class='kw'>df</span>, <span class='st'>"bacteria"</span>)
|
||||
<span class='fu'><a href='https://rdrr.io/r/base/colnames.html'>colnames</a></span>(<span class='kw'>df_joined</span>)
|
||||
}
|
||||
<span class='co'># }</span>
|
||||
</pre>
|
||||
</div>
|
||||
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
|
||||
|
@ -50,7 +50,7 @@
|
||||
|
||||
<meta property="og:title" content="Key antibiotics for first weighted isolates — key_antibiotics" />
|
||||
<meta property="og:description" content="These function can be used to determine first isolates (see first_isolate()). Using key antibiotics to determine first isolates is more reliable than without key antibiotics. These selected isolates will then be called first weighted isolates." />
|
||||
<meta property="og:image" content="https://msberends.github.io/AMR/logo.svg" />
|
||||
<meta property="og:image" content="https://msberends.github.io/AMR/logo.png" />
|
||||
|
||||
|
||||
|
||||
@ -82,7 +82,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.9015</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -395,32 +395,35 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
<pre class="examples"><span class='co'># `example_isolates` is a dataset available in the AMR package.</span>
|
||||
<span class='co'># See ?example_isolates.</span>
|
||||
|
||||
<span class='co'>if</span> (<span class='fl'>FALSE</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='co'># set key antibiotics to a new variable</span>
|
||||
<span class='kw'>my_patients</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/mutate.html'>mutate</a></span>(keyab = <span class='fu'>key_antibiotics</span>(<span class='kw'>.</span>)) <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(
|
||||
<span class='co'># now calculate first isolates</span>
|
||||
first_regular = <span class='fu'><a href='first_isolate.html'>first_isolate</a></span>(<span class='kw'>.</span>, col_keyantibiotics = <span class='fl'>FALSE</span>),
|
||||
<span class='co'># and first WEIGHTED isolates</span>
|
||||
first_weighted = <span class='fu'><a href='first_isolate.html'>first_isolate</a></span>(<span class='kw'>.</span>, col_keyantibiotics = <span class='st'>"keyab"</span>)
|
||||
)
|
||||
|
||||
<span class='co'># Check the difference, in this data set it results in 7% more isolates:</span>
|
||||
<span class='fu'><a href='https://rdrr.io/r/base/sum.html'>sum</a></span>(<span class='kw'>my_patients</span><span class='op'>$</span><span class='kw'>first_regular</span>, na.rm = <span class='fl'>TRUE</span>)
|
||||
<span class='fu'><a href='https://rdrr.io/r/base/sum.html'>sum</a></span>(<span class='kw'>my_patients</span><span class='op'>$</span><span class='kw'>first_weighted</span>, na.rm = <span class='fl'>TRUE</span>)
|
||||
}
|
||||
|
||||
<span class='co'># output of the `key_antibiotics` function could be like this:</span>
|
||||
<span class='kw'>strainA</span> <span class='op'><-</span> <span class='st'>"SSSRR.S.R..S"</span>
|
||||
<span class='kw'>strainB</span> <span class='op'><-</span> <span class='st'>"SSSIRSSSRSSS"</span>
|
||||
|
||||
<span class='co'># can those strings can be compared with:</span>
|
||||
<span class='fu'>key_antibiotics_equal</span>(<span class='kw'>strainA</span>, <span class='kw'>strainB</span>)
|
||||
<span class='co'># TRUE, because I is ignored (as well as missing values)</span>
|
||||
|
||||
<span class='fu'>key_antibiotics_equal</span>(<span class='kw'>strainA</span>, <span class='kw'>strainB</span>, ignore_I = <span class='fl'>FALSE</span>)
|
||||
<span class='co'># FALSE, because I is not ignored and so the 4th value differs</span></pre>
|
||||
<span class='co'># FALSE, because I is not ignored and so the 4th value differs</span>
|
||||
|
||||
<span class='co'># \donttest{</span>
|
||||
<span class='co'>if</span> (<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='st'><a href='https://dplyr.tidyverse.org'>"dplyr"</a></span>)) {
|
||||
<span class='co'># set key antibiotics to a new variable</span>
|
||||
<span class='kw'>my_patients</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/mutate.html'>mutate</a></span>(keyab = <span class='fu'>key_antibiotics</span>(<span class='kw'>.</span>)) <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(
|
||||
<span class='co'># now calculate first isolates</span>
|
||||
first_regular = <span class='fu'><a href='first_isolate.html'>first_isolate</a></span>(<span class='kw'>.</span>, col_keyantibiotics = <span class='fl'>FALSE</span>),
|
||||
<span class='co'># and first WEIGHTED isolates</span>
|
||||
first_weighted = <span class='fu'><a href='first_isolate.html'>first_isolate</a></span>(<span class='kw'>.</span>, col_keyantibiotics = <span class='st'>"keyab"</span>)
|
||||
)
|
||||
|
||||
<span class='co'># Check the difference, in this data set it results in 7% more isolates:</span>
|
||||
<span class='fu'><a href='https://rdrr.io/r/base/sum.html'>sum</a></span>(<span class='kw'>my_patients</span><span class='op'>$</span><span class='kw'>first_regular</span>, na.rm = <span class='fl'>TRUE</span>)
|
||||
<span class='fu'><a href='https://rdrr.io/r/base/sum.html'>sum</a></span>(<span class='kw'>my_patients</span><span class='op'>$</span><span class='kw'>first_weighted</span>, na.rm = <span class='fl'>TRUE</span>)
|
||||
}
|
||||
<span class='co'># }</span>
|
||||
</pre>
|
||||
</div>
|
||||
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
|
||||
<nav id="toc" data-toggle="toc" class="sticky-top">
|
||||
|
@ -82,7 +82,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.9026</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -313,11 +313,12 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
<span class='co'>#> TRUE TRUE TRUE</span>
|
||||
|
||||
<span class='co'># get isolates whose name start with 'Ent' or 'ent'</span>
|
||||
<span class='co'>if</span> (<span class='fl'>FALSE</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='kw'>example_isolates</span> <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='fu'><a href='mo_property.html'>mo_name</a></span>(<span class='kw'>mo</span>) <span class='op'>%like%</span> <span class='st'>"^ent"</span>)
|
||||
<span class='co'># \donttest{</span>
|
||||
<span class='co'>if</span> (<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='st'><a href='https://dplyr.tidyverse.org'>"dplyr"</a></span>)) {
|
||||
<span class='kw'>example_isolates</span> <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='fu'><a href='mo_property.html'>mo_name</a></span>(<span class='kw'>mo</span>) <span class='op'>%like%</span> <span class='st'>"^ent"</span>)
|
||||
}
|
||||
<span class='co'># }</span>
|
||||
</pre>
|
||||
</div>
|
||||
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
|
||||
|
File diff suppressed because one or more lines are too long
@ -82,7 +82,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.9034</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -265,21 +265,22 @@
|
||||
<p>$$m_{(x, n)} = \frac{l_{n} - 0.5 \cdot \min \begin{cases}l_{n} \\ \operatorname{lev}(x, n)\end{cases}}{l_{n} \cdot p_{n} \cdot k_{n}}$$</p>
|
||||
<p>where:</p><ul>
|
||||
<li><p>\(x\) is the user input;</p></li>
|
||||
<li><p>\(n\) is a taxonomic name (genus, species and subspecies) as found in <code><a href='microorganisms.html'>microorganisms$fullname</a></code>;</p></li>
|
||||
<li><p>\(l_{n}\) is the length of \(n\);</p></li>
|
||||
<li><p>\(\operatorname{lev}\) is the <a href='https://en.wikipedia.org/wiki/Levenshtein_distance'>Levenshtein distance function</a>;</p></li>
|
||||
<li><p>\(p_{n}\) is the human pathogenic prevalence of \(n\), categorised into group \(1\), \(2\) and \(3\) (see <em>Details</em> in <code><a href='as.mo.html'>?as.mo</a></code>), meaning that \(p = \{1, 2 , 3\}\);</p></li>
|
||||
<li><p>\(k_{n}\) is the kingdom index of \(n\), set as follows: Bacteria = \(1\), Fungi = \(2\), Protozoa = \(3\), Archaea = \(4\), and all others = \(5\), meaning that \(k = \{1, 2 , 3, 4, 5\}\).</p></li>
|
||||
<li><p>\(n\) is a taxonomic name (genus, species, and subspecies);</p></li>
|
||||
<li><p>\(l_n\) is the length of \(n\);</p></li>
|
||||
<li><p>lev is the <a href='https://en.wikipedia.org/wiki/Levenshtein_distance'>Levenshtein distance function</a>, which counts any insertion, deletion and substitution as 1 that is needed to change \(x\) into \(n\);</p></li>
|
||||
<li><p>\(p_n\) is the human pathogenic prevalence group of \(n\), as described below;</p></li>
|
||||
<li><p>\(k_n\) is the taxonomic kingdom of \(n\), set as Bacteria = 1, Fungi = 2, Protozoa = 3, Archaea = 4, others = 5.</p></li>
|
||||
</ul>
|
||||
|
||||
<p>This means that the user input <code>x = "E. coli"</code> gets for <em>Escherichia coli</em> a matching score of 68.8% and for <em>Entamoeba coli</em> a matching score of 7.9%.</p>
|
||||
<p>All matches are sorted descending on their matching score and for all user input values, the top match will be returned.</p>
|
||||
<p>The grouping into human pathogenic prevalence (\(p\)) is based on experience from several microbiological laboratories in the Netherlands in conjunction with international reports on pathogen prevalence. <strong>Group 1</strong> (most prevalent microorganisms) consists of all microorganisms where the taxonomic class is Gammaproteobacteria or where the taxonomic genus is <em>Enterococcus</em>, <em>Staphylococcus</em> or <em>Streptococcus</em>. This group consequently contains all common Gram-negative bacteria, such as <em>Pseudomonas</em> and <em>Legionella</em> and all species within the order Enterobacterales. <strong>Group 2</strong> consists of all microorganisms where the taxonomic phylum is Proteobacteria, Firmicutes, Actinobacteria or Sarcomastigophora, or where the taxonomic genus is <em>Absidia</em>, <em>Acremonium</em>, <em>Actinotignum</em>, <em>Alternaria</em>, <em>Anaerosalibacter</em>, <em>Apophysomyces</em>, <em>Arachnia</em>, <em>Aspergillus</em>, <em>Aureobacterium</em>, <em>Aureobasidium</em>, <em>Bacteroides</em>, <em>Basidiobolus</em>, <em>Beauveria</em>, <em>Blastocystis</em>, <em>Branhamella</em>, <em>Calymmatobacterium</em>, <em>Candida</em>, <em>Capnocytophaga</em>, <em>Catabacter</em>, <em>Chaetomium</em>, <em>Chryseobacterium</em>, <em>Chryseomonas</em>, <em>Chrysonilia</em>, <em>Cladophialophora</em>, <em>Cladosporium</em>, <em>Conidiobolus</em>, <em>Cryptococcus</em>, <em>Curvularia</em>, <em>Exophiala</em>, <em>Exserohilum</em>, <em>Flavobacterium</em>, <em>Fonsecaea</em>, <em>Fusarium</em>, <em>Fusobacterium</em>, <em>Hendersonula</em>, <em>Hypomyces</em>, <em>Koserella</em>, <em>Lelliottia</em>, <em>Leptosphaeria</em>, <em>Leptotrichia</em>, <em>Malassezia</em>, <em>Malbranchea</em>, <em>Mortierella</em>, <em>Mucor</em>, <em>Mycocentrospora</em>, <em>Mycoplasma</em>, <em>Nectria</em>, <em>Ochroconis</em>, <em>Oidiodendron</em>, <em>Phoma</em>, <em>Piedraia</em>, <em>Pithomyces</em>, <em>Pityrosporum</em>, <em>Prevotella</em>,\<em>Pseudallescheria</em>, <em>Rhizomucor</em>, <em>Rhizopus</em>, <em>Rhodotorula</em>, <em>Scolecobasidium</em>, <em>Scopulariopsis</em>, <em>Scytalidium</em>,<em>Sporobolomyces</em>, <em>Stachybotrys</em>, <em>Stomatococcus</em>, <em>Treponema</em>, <em>Trichoderma</em>, <em>Trichophyton</em>, <em>Trichosporon</em>, <em>Tritirachium</em> or <em>Ureaplasma</em>. <strong>Group 3</strong> consists of all other microorganisms.</p>
|
||||
<p>All matches are sorted descending on their matching score and for all user input values, the top match will be returned. This will lead to the effect that e.g., <code>"E. coli"</code> will return the microbial ID of <em>Escherichia coli</em> (\(m = 0.688\), a highly prevalent microorganism found in humans) and not <em>Entamoeba coli</em> (\(m = 0.079\), a less prevalent microorganism in humans), although the latter would alphabetically come first.</p>
|
||||
|
||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||
<pre class="examples"><span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='st'>"E. coli"</span>)
|
||||
<span class='fu'><a href='as.mo.html'>mo_uncertainties</a></span>()
|
||||
|
||||
<span class='fu'>mo_matching_score</span>(<span class='st'>"E. coli"</span>, <span class='st'>"Escherichia coli"</span>)
|
||||
<span class='fu'>mo_matching_score</span>(x = <span class='st'>"E. coli"</span>,
|
||||
n = <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"Escherichia coli"</span>, <span class='st'>"Entamoeba coli"</span>))
|
||||
</pre>
|
||||
</div>
|
||||
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
|
||||
|
@ -82,7 +82,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.9034</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -354,15 +354,15 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
<p>$$m_{(x, n)} = \frac{l_{n} - 0.5 \cdot \min \begin{cases}l_{n} \\ \operatorname{lev}(x, n)\end{cases}}{l_{n} \cdot p_{n} \cdot k_{n}}$$</p>
|
||||
<p>where:</p><ul>
|
||||
<li><p>\(x\) is the user input;</p></li>
|
||||
<li><p>\(n\) is a taxonomic name (genus, species and subspecies) as found in <code><a href='microorganisms.html'>microorganisms$fullname</a></code>;</p></li>
|
||||
<li><p>\(l_{n}\) is the length of \(n\);</p></li>
|
||||
<li><p>\(\operatorname{lev}\) is the <a href='https://en.wikipedia.org/wiki/Levenshtein_distance'>Levenshtein distance function</a>;</p></li>
|
||||
<li><p>\(p_{n}\) is the human pathogenic prevalence of \(n\), categorised into group \(1\), \(2\) and \(3\) (see <em>Details</em> in <code><a href='as.mo.html'>?as.mo</a></code>), meaning that \(p = \{1, 2 , 3\}\);</p></li>
|
||||
<li><p>\(k_{n}\) is the kingdom index of \(n\), set as follows: Bacteria = \(1\), Fungi = \(2\), Protozoa = \(3\), Archaea = \(4\), and all others = \(5\), meaning that \(k = \{1, 2 , 3, 4, 5\}\).</p></li>
|
||||
<li><p>\(n\) is a taxonomic name (genus, species, and subspecies);</p></li>
|
||||
<li><p>\(l_n\) is the length of \(n\);</p></li>
|
||||
<li><p>lev is the <a href='https://en.wikipedia.org/wiki/Levenshtein_distance'>Levenshtein distance function</a>, which counts any insertion, deletion and substitution as 1 that is needed to change \(x\) into \(n\);</p></li>
|
||||
<li><p>\(p_n\) is the human pathogenic prevalence group of \(n\), as described below;</p></li>
|
||||
<li><p>\(k_n\) is the taxonomic kingdom of \(n\), set as Bacteria = 1, Fungi = 2, Protozoa = 3, Archaea = 4, others = 5.</p></li>
|
||||
</ul>
|
||||
|
||||
<p>This means that the user input <code>x = "E. coli"</code> gets for <em>Escherichia coli</em> a matching score of 68.8% and for <em>Entamoeba coli</em> a matching score of 7.9%.</p>
|
||||
<p>All matches are sorted descending on their matching score and for all user input values, the top match will be returned.</p>
|
||||
<p>The grouping into human pathogenic prevalence (\(p\)) is based on experience from several microbiological laboratories in the Netherlands in conjunction with international reports on pathogen prevalence. <strong>Group 1</strong> (most prevalent microorganisms) consists of all microorganisms where the taxonomic class is Gammaproteobacteria or where the taxonomic genus is <em>Enterococcus</em>, <em>Staphylococcus</em> or <em>Streptococcus</em>. This group consequently contains all common Gram-negative bacteria, such as <em>Pseudomonas</em> and <em>Legionella</em> and all species within the order Enterobacterales. <strong>Group 2</strong> consists of all microorganisms where the taxonomic phylum is Proteobacteria, Firmicutes, Actinobacteria or Sarcomastigophora, or where the taxonomic genus is <em>Absidia</em>, <em>Acremonium</em>, <em>Actinotignum</em>, <em>Alternaria</em>, <em>Anaerosalibacter</em>, <em>Apophysomyces</em>, <em>Arachnia</em>, <em>Aspergillus</em>, <em>Aureobacterium</em>, <em>Aureobasidium</em>, <em>Bacteroides</em>, <em>Basidiobolus</em>, <em>Beauveria</em>, <em>Blastocystis</em>, <em>Branhamella</em>, <em>Calymmatobacterium</em>, <em>Candida</em>, <em>Capnocytophaga</em>, <em>Catabacter</em>, <em>Chaetomium</em>, <em>Chryseobacterium</em>, <em>Chryseomonas</em>, <em>Chrysonilia</em>, <em>Cladophialophora</em>, <em>Cladosporium</em>, <em>Conidiobolus</em>, <em>Cryptococcus</em>, <em>Curvularia</em>, <em>Exophiala</em>, <em>Exserohilum</em>, <em>Flavobacterium</em>, <em>Fonsecaea</em>, <em>Fusarium</em>, <em>Fusobacterium</em>, <em>Hendersonula</em>, <em>Hypomyces</em>, <em>Koserella</em>, <em>Lelliottia</em>, <em>Leptosphaeria</em>, <em>Leptotrichia</em>, <em>Malassezia</em>, <em>Malbranchea</em>, <em>Mortierella</em>, <em>Mucor</em>, <em>Mycocentrospora</em>, <em>Mycoplasma</em>, <em>Nectria</em>, <em>Ochroconis</em>, <em>Oidiodendron</em>, <em>Phoma</em>, <em>Piedraia</em>, <em>Pithomyces</em>, <em>Pityrosporum</em>, <em>Prevotella</em>,\<em>Pseudallescheria</em>, <em>Rhizomucor</em>, <em>Rhizopus</em>, <em>Rhodotorula</em>, <em>Scolecobasidium</em>, <em>Scopulariopsis</em>, <em>Scytalidium</em>,<em>Sporobolomyces</em>, <em>Stachybotrys</em>, <em>Stomatococcus</em>, <em>Treponema</em>, <em>Trichoderma</em>, <em>Trichophyton</em>, <em>Trichosporon</em>, <em>Tritirachium</em> or <em>Ureaplasma</em>. <strong>Group 3</strong> consists of all other microorganisms.</p>
|
||||
<p>All matches are sorted descending on their matching score and for all user input values, the top match will be returned. This will lead to the effect that e.g., <code>"E. coli"</code> will return the microbial ID of <em>Escherichia coli</em> (\(m = 0.688\), a highly prevalent microorganism found in humans) and not <em>Entamoeba coli</em> (\(m = 0.079\), a less prevalent microorganism in humans), although the latter would alphabetically come first.</p>
|
||||
<h2 class="hasAnchor" id="catalogue-of-life"><a class="anchor" href="#catalogue-of-life"></a>Catalogue of Life</h2>
|
||||
|
||||
|
||||
|
@ -50,7 +50,7 @@
|
||||
|
||||
<meta property="og:title" content="Symbol of a p-value — p_symbol" />
|
||||
<meta property="og:description" content="Return the symbol related to the p-value: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1. Values above p = 1 will return NA." />
|
||||
<meta property="og:image" content="https://msberends.github.io/AMR/logo.svg" />
|
||||
<meta property="og:image" content="https://msberends.github.io/AMR/logo.png" />
|
||||
|
||||
|
||||
|
||||
@ -82,7 +82,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.9015</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -260,6 +260,9 @@
|
||||
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
|
||||
|
||||
<p>Text</p>
|
||||
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
|
||||
|
||||
<p><strong>NOTE</strong>: this function will be moved to the <code>cleaner</code> package when a new version is being published on CRAN.</p>
|
||||
<h2 class="hasAnchor" id="questioning-lifecycle"><a class="anchor" href="#questioning-lifecycle"></a>Questioning lifecycle</h2>
|
||||
|
||||
|
||||
|
@ -50,7 +50,7 @@
|
||||
|
||||
<meta property="og:title" content="Principal Component Analysis (for AMR) — pca" />
|
||||
<meta property="og:description" content="Performs a principal component analysis (PCA) based on a data set with automatic determination for afterwards plotting the groups and labels, and automatic filtering on only suitable (i.e. non-empty and numeric) variables." />
|
||||
<meta property="og:image" content="https://msberends.github.io/AMR/logo.svg" />
|
||||
<meta property="og:image" content="https://msberends.github.io/AMR/logo.png" />
|
||||
|
||||
|
||||
|
||||
@ -82,7 +82,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.9015</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -322,23 +322,26 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>maturing<
|
||||
<pre class="examples"><span class='co'># `example_isolates` is a dataset available in the AMR package.</span>
|
||||
<span class='co'># See ?example_isolates.</span>
|
||||
|
||||
<span class='co'>if</span> (<span class='fl'>FALSE</span>) {
|
||||
<span class='co'># calculate the resistance per group first</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='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='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='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='co'># then get resistance of all drugs</span>
|
||||
|
||||
<span class='co'># now conduct PCA for certain antimicrobial agents</span>
|
||||
<span class='kw'>pca_result</span> <span class='op'><-</span> <span class='kw'>resistance_data</span> <span class='op'>%>%</span>
|
||||
<span class='fu'>pca</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='kw'>pca_result</span>
|
||||
<span class='fu'><a href='https://rdrr.io/r/base/summary.html'>summary</a></span>(<span class='kw'>pca_result</span>)
|
||||
<span class='fu'><a href='https://rdrr.io/r/stats/biplot.html'>biplot</a></span>(<span class='kw'>pca_result</span>)
|
||||
<span class='fu'><a href='ggplot_pca.html'>ggplot_pca</a></span>(<span class='kw'>pca_result</span>) <span class='co'># a new and convenient plot function</span>
|
||||
}</pre>
|
||||
<span class='co'># \donttest{</span>
|
||||
|
||||
<span class='co'>if</span> (<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='st'><a href='https://dplyr.tidyverse.org'>"dplyr"</a></span>)) {
|
||||
<span class='co'># calculate the resistance per group first </span>
|
||||
<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='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='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='co'># then get resistance of all drugs</span>
|
||||
|
||||
<span class='co'># now conduct PCA for certain antimicrobial agents</span>
|
||||
<span class='kw'>pca_result</span> <span class='op'><-</span> <span class='kw'>resistance_data</span> <span class='op'>%>%</span>
|
||||
<span class='fu'>pca</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='kw'>pca_result</span>
|
||||
<span class='fu'><a href='https://rdrr.io/r/base/summary.html'>summary</a></span>(<span class='kw'>pca_result</span>)
|
||||
<span class='fu'><a href='https://rdrr.io/r/stats/biplot.html'>biplot</a></span>(<span class='kw'>pca_result</span>)
|
||||
<span class='fu'><a href='ggplot_pca.html'>ggplot_pca</a></span>(<span class='kw'>pca_result</span>) <span class='co'># a new and convenient plot function</span>
|
||||
}
|
||||
<span class='co'># }</span>
|
||||
</pre>
|
||||
</div>
|
||||
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
|
||||
<nav id="toc" data-toggle="toc" class="sticky-top">
|
||||
|
@ -83,7 +83,7 @@ resistance() should be used to calculate resistance, susceptibility() should be
|
||||
</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.9026</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -464,15 +464,6 @@ A microorganism is categorised as <em>Susceptible, Increased exposure</em> when
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='kw'>hospital_id</span>) <span class='op'>%>%</span>
|
||||
<span class='fu'>proportion_df</span>(translate = <span class='fl'>FALSE</span>)
|
||||
}
|
||||
|
||||
<span class='co'>if</span> (<span class='fl'>FALSE</span>) {
|
||||
<span class='co'># calculate current empiric combination therapy of Helicobacter gastritis:</span>
|
||||
<span class='kw'>my_table</span> <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='kw'>first_isolate</span> <span class='op'>==</span> <span class='fl'>TRUE</span>,
|
||||
<span class='kw'>genus</span> <span class='op'>==</span> <span class='st'>"Helicobacter"</span>) <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(p = <span class='fu'>susceptibility</span>(<span class='kw'>AMX</span>, <span class='kw'>MTR</span>), <span class='co'># amoxicillin with metronidazole</span>
|
||||
n = <span class='fu'><a href='count.html'>count_all</a></span>(<span class='kw'>AMX</span>, <span class='kw'>MTR</span>))
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
|
||||
|
@ -82,7 +82,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.9026</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -418,9 +418,7 @@ A microorganism is categorised as <em>Susceptible, Increased exposure</em> when
|
||||
}
|
||||
|
||||
<span class='co'># create nice plots with ggplot2 yourself</span>
|
||||
<span class='co'>if</span> (<span class='fl'>FALSE</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://rdrr.io/r/base/library.html'>library</a></span>(<span class='kw'><a href='http://ggplot2.tidyverse.org'>ggplot2</a></span>)
|
||||
<span class='co'>if</span> (<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='st'><a href='https://dplyr.tidyverse.org'>"dplyr"</a></span>) <span class='op'>&</span> <span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='st'><a href='http://ggplot2.tidyverse.org'>"ggplot2"</a></span>)) {
|
||||
|
||||
<span class='kw'>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/filter.html'>filter</a></span>(<span class='kw'>mo</span> <span class='op'>==</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='st'>"E. coli"</span>)) <span class='op'>%>%</span>
|
||||
|
@ -3,9 +3,6 @@
|
||||
<url>
|
||||
<loc>https://msberends.github.io/AMR/index.html</loc>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://msberends.github.io/AMR/reference/AMR-deprecated.html</loc>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://msberends.github.io/AMR/reference/AMR.html</loc>
|
||||
</url>
|
||||
|
@ -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.9034</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
Reference in New Issue
Block a user