mirror of
https://github.com/msberends/AMR.git
synced 2024-12-26 06:46:11 +01:00
418 lines
55 KiB
HTML
418 lines
55 KiB
HTML
<!DOCTYPE html>
|
||
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Determine First Isolates — first_isolate • AMR (for R)</title><!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png"><link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png"><link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png"><link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png"><link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png"><link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/Lato-0.4.9/font.css" rel="stylesheet"><link href="../deps/Fira_Code-0.4.9/font.css" rel="stylesheet"><link href="../deps/font-awesome-6.4.2/css/all.min.css" rel="stylesheet"><link href="../deps/font-awesome-6.4.2/css/v4-shims.min.css" rel="stylesheet"><script src="../deps/headroom-0.11.0/headroom.min.js"></script><script src="../deps/headroom-0.11.0/jQuery.headroom.min.js"></script><script src="../deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js"></script><script src="../deps/clipboard.js-2.0.11/clipboard.min.js"></script><script src="../deps/search-1.0.0/autocomplete.jquery.min.js"></script><script src="../deps/search-1.0.0/fuse.min.js"></script><script src="../deps/search-1.0.0/mark.min.js"></script><!-- pkgdown --><script src="../pkgdown.js"></script><link href="../extra.css" rel="stylesheet"><script src="../extra.js"></script><meta property="og:title" content="Determine First Isolates — first_isolate"><meta name="description" content="Determine first isolates of all microorganisms of every patient per episode and (if needed) per specimen type. These functions support all four methods as summarised by Hindler et al. in 2007 (doi:10.1086/511864
|
||
). To determine patient episodes not necessarily based on microorganisms, use is_new_episode() that also supports grouping with the dplyr package."><meta property="og:description" content="Determine first isolates of all microorganisms of every patient per episode and (if needed) per specimen type. These functions support all four methods as summarised by Hindler et al. in 2007 (doi:10.1086/511864
|
||
). To determine patient episodes not necessarily based on microorganisms, use is_new_episode() that also supports grouping with the dplyr package."><meta property="og:image" content="https://msberends.github.io/AMR/logo.svg"></head><body>
|
||
<a href="#main" class="visually-hidden-focusable">Skip to contents</a>
|
||
|
||
|
||
<nav class="navbar navbar-expand-lg fixed-top bg-primary" data-bs-theme="dark" aria-label="Site navigation"><div class="container">
|
||
|
||
<a class="navbar-brand me-2" href="../index.html">AMR (for R)</a>
|
||
|
||
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9095</small>
|
||
|
||
|
||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
|
||
<span class="navbar-toggler-icon"></span>
|
||
</button>
|
||
|
||
<div id="navbar" class="collapse navbar-collapse ms-3">
|
||
<ul class="navbar-nav me-auto"><li class="nav-item dropdown">
|
||
<button class="nav-link dropdown-toggle" type="button" id="dropdown-how-to" data-bs-toggle="dropdown" aria-expanded="false" aria-haspopup="true"><span class="fa fa-question-circle"></span> How to</button>
|
||
<ul class="dropdown-menu" aria-labelledby="dropdown-how-to"><li><a class="dropdown-item" href="../articles/AMR.html"><span class="fa fa-directions"></span> Conduct AMR Analysis</a></li>
|
||
<li><a class="dropdown-item" href="../reference/antibiogram.html"><span class="fa fa-file-prescription"></span> Generate Antibiogram (Trad./Syndromic/WISCA)</a></li>
|
||
<li><a class="dropdown-item" href="../articles/resistance_predict.html"><span class="fa fa-dice"></span> Predict Antimicrobial Resistance</a></li>
|
||
<li><a class="dropdown-item" href="../articles/datasets.html"><span class="fa fa-database"></span> Download Data Sets for Own Use</a></li>
|
||
<li><a class="dropdown-item" href="../reference/AMR-options.html"><span class="fa fa-gear"></span> Set User- Or Team-specific Package Settings</a></li>
|
||
<li><a class="dropdown-item" href="../articles/PCA.html"><span class="fa fa-compress"></span> Conduct Principal Component Analysis for AMR</a></li>
|
||
<li><a class="dropdown-item" href="../articles/MDR.html"><span class="fa fa-skull-crossbones"></span> Determine Multi-Drug Resistance (MDR)</a></li>
|
||
<li><a class="dropdown-item" href="../articles/WHONET.html"><span class="fa fa-globe-americas"></span> Work with WHONET Data</a></li>
|
||
<li><a class="dropdown-item" href="../articles/EUCAST.html"><span class="fa fa-exchange-alt"></span> Apply Eucast Rules</a></li>
|
||
<li><a class="dropdown-item" href="../reference/mo_property.html"><span class="fa fa-bug"></span> Get Taxonomy of a Microorganism</a></li>
|
||
<li><a class="dropdown-item" href="../reference/ab_property.html"><span class="fa fa-capsules"></span> Get Properties of an Antibiotic Drug</a></li>
|
||
<li><a class="dropdown-item" href="../reference/av_property.html"><span class="fa fa-capsules"></span> Get Properties of an Antiviral Drug</a></li>
|
||
</ul></li>
|
||
<li class="nav-item"><a class="nav-link" href="../articles/AMR_for_Python.html"><span class="fa fab fa-python"></span> AMR for Python</a></li>
|
||
<li class="active nav-item"><a class="nav-link" href="../reference/index.html"><span class="fa fa-book-open"></span> Manual</a></li>
|
||
<li class="nav-item"><a class="nav-link" href="../authors.html"><span class="fa fa-users"></span> Authors</a></li>
|
||
</ul><ul class="navbar-nav"><li class="nav-item"><a class="nav-link" href="../news/index.html"><span class="fa far fa-newspaper"></span> Changelog</a></li>
|
||
<li class="nav-item"><a class="external-link nav-link" href="https://github.com/msberends/AMR"><span class="fa fab fa-github"></span> Source Code</a></li>
|
||
</ul></div>
|
||
|
||
|
||
</div>
|
||
</nav><div class="container template-reference-topic">
|
||
<div class="row">
|
||
<main id="main" class="col-md-9"><div class="page-header">
|
||
<img src="../logo.svg" class="logo" alt=""><h1>Determine First Isolates</h1>
|
||
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/main/R/first_isolate.R" class="external-link"><code>R/first_isolate.R</code></a></small>
|
||
<div class="d-none name"><code>first_isolate.Rd</code></div>
|
||
</div>
|
||
|
||
<div class="ref-description section level2">
|
||
<p>Determine first isolates of all microorganisms of every patient per episode and (if needed) per specimen type. These functions support all four methods as summarised by Hindler <em>et al.</em> in 2007 (<a href="https://doi.org/10.1086/511864" class="external-link">doi:10.1086/511864</a>
|
||
). To determine patient episodes not necessarily based on microorganisms, use <code><a href="get_episode.html">is_new_episode()</a></code> that also supports grouping with the <code>dplyr</code> package.</p>
|
||
</div>
|
||
|
||
<div class="section level2">
|
||
<h2 id="ref-usage">Usage<a class="anchor" aria-label="anchor" href="#ref-usage"></a></h2>
|
||
<div class="sourceCode"><pre class="sourceCode r"><code><span><span class="fu">first_isolate</span><span class="op">(</span></span>
|
||
<span> x <span class="op">=</span> <span class="cn">NULL</span>,</span>
|
||
<span> col_date <span class="op">=</span> <span class="cn">NULL</span>,</span>
|
||
<span> col_patient_id <span class="op">=</span> <span class="cn">NULL</span>,</span>
|
||
<span> col_mo <span class="op">=</span> <span class="cn">NULL</span>,</span>
|
||
<span> col_testcode <span class="op">=</span> <span class="cn">NULL</span>,</span>
|
||
<span> col_specimen <span class="op">=</span> <span class="cn">NULL</span>,</span>
|
||
<span> col_icu <span class="op">=</span> <span class="cn">NULL</span>,</span>
|
||
<span> col_keyantimicrobials <span class="op">=</span> <span class="cn">NULL</span>,</span>
|
||
<span> episode_days <span class="op">=</span> <span class="fl">365</span>,</span>
|
||
<span> testcodes_exclude <span class="op">=</span> <span class="cn">NULL</span>,</span>
|
||
<span> icu_exclude <span class="op">=</span> <span class="cn">FALSE</span>,</span>
|
||
<span> specimen_group <span class="op">=</span> <span class="cn">NULL</span>,</span>
|
||
<span> type <span class="op">=</span> <span class="st">"points"</span>,</span>
|
||
<span> method <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"phenotype-based"</span>, <span class="st">"episode-based"</span>, <span class="st">"patient-based"</span>, <span class="st">"isolate-based"</span><span class="op">)</span>,</span>
|
||
<span> ignore_I <span class="op">=</span> <span class="cn">TRUE</span>,</span>
|
||
<span> points_threshold <span class="op">=</span> <span class="fl">2</span>,</span>
|
||
<span> info <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/interactive.html" class="external-link">interactive</a></span><span class="op">(</span><span class="op">)</span>,</span>
|
||
<span> include_unknown <span class="op">=</span> <span class="cn">FALSE</span>,</span>
|
||
<span> include_untested_sir <span class="op">=</span> <span class="cn">TRUE</span>,</span>
|
||
<span> <span class="va">...</span></span>
|
||
<span><span class="op">)</span></span>
|
||
<span></span>
|
||
<span><span class="fu">filter_first_isolate</span><span class="op">(</span></span>
|
||
<span> x <span class="op">=</span> <span class="cn">NULL</span>,</span>
|
||
<span> col_date <span class="op">=</span> <span class="cn">NULL</span>,</span>
|
||
<span> col_patient_id <span class="op">=</span> <span class="cn">NULL</span>,</span>
|
||
<span> col_mo <span class="op">=</span> <span class="cn">NULL</span>,</span>
|
||
<span> episode_days <span class="op">=</span> <span class="fl">365</span>,</span>
|
||
<span> method <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"phenotype-based"</span>, <span class="st">"episode-based"</span>, <span class="st">"patient-based"</span>, <span class="st">"isolate-based"</span><span class="op">)</span>,</span>
|
||
<span> <span class="va">...</span></span>
|
||
<span><span class="op">)</span></span></code></pre></div>
|
||
</div>
|
||
|
||
<div class="section level2">
|
||
<h2 id="source">Source<a class="anchor" aria-label="anchor" href="#source"></a></h2>
|
||
<p>Methodology of this function is strictly based on:</p><ul><li><p><strong>M39 Analysis and Presentation of Cumulative Antimicrobial Susceptibility Test Data, 5th Edition</strong>, 2022, <em>Clinical and Laboratory Standards Institute (CLSI)</em>. <a href="https://clsi.org/standards/products/microbiology/documents/m39/" class="external-link">https://clsi.org/standards/products/microbiology/documents/m39/</a>.</p></li>
|
||
<li><p>Hindler JF and Stelling J (2007). <strong>Analysis and Presentation of Cumulative Antibiograms: A New Consensus Guideline from the Clinical and Laboratory Standards Institute.</strong> Clinical Infectious Diseases, 44(6), 867-873. <a href="https://doi.org/10.1086/511864" class="external-link">doi:10.1086/511864</a></p></li>
|
||
</ul></div>
|
||
<div class="section level2">
|
||
<h2 id="arguments">Arguments<a class="anchor" aria-label="anchor" href="#arguments"></a></h2>
|
||
|
||
|
||
<dl><dt id="arg-x">x<a class="anchor" aria-label="anchor" href="#arg-x"></a></dt>
|
||
<dd><p>a <a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a> containing isolates. Can be left blank for automatic determination, see <em>Examples</em>.</p></dd>
|
||
|
||
|
||
<dt id="arg-col-date">col_date<a class="anchor" aria-label="anchor" href="#arg-col-date"></a></dt>
|
||
<dd><p>column name of the result date (or date that is was received on the lab) - the default is the first column with a date class</p></dd>
|
||
|
||
|
||
<dt id="arg-col-patient-id">col_patient_id<a class="anchor" aria-label="anchor" href="#arg-col-patient-id"></a></dt>
|
||
<dd><p>column name of the unique IDs of the patients - the default is the first column that starts with 'patient' or 'patid' (case insensitive)</p></dd>
|
||
|
||
|
||
<dt id="arg-col-mo">col_mo<a class="anchor" aria-label="anchor" href="#arg-col-mo"></a></dt>
|
||
<dd><p>column name of the names or codes of the microorganisms (see <code><a href="as.mo.html">as.mo()</a></code>) - the default is the first column of class <code><a href="as.mo.html">mo</a></code>. Values will be coerced using <code><a href="as.mo.html">as.mo()</a></code>.</p></dd>
|
||
|
||
|
||
<dt id="arg-col-testcode">col_testcode<a class="anchor" aria-label="anchor" href="#arg-col-testcode"></a></dt>
|
||
<dd><p>column name of the test codes. Use <code>col_testcode = NULL</code> to <strong>not</strong> exclude certain test codes (such as test codes for screening). In that case <code>testcodes_exclude</code> will be ignored.</p></dd>
|
||
|
||
|
||
<dt id="arg-col-specimen">col_specimen<a class="anchor" aria-label="anchor" href="#arg-col-specimen"></a></dt>
|
||
<dd><p>column name of the specimen type or group</p></dd>
|
||
|
||
|
||
<dt id="arg-col-icu">col_icu<a class="anchor" aria-label="anchor" href="#arg-col-icu"></a></dt>
|
||
<dd><p>column name of the logicals (<code>TRUE</code>/<code>FALSE</code>) whether a ward or department is an Intensive Care Unit (ICU). This can also be a <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a> vector with the same length as rows in <code>x</code>.</p></dd>
|
||
|
||
|
||
<dt id="arg-col-keyantimicrobials">col_keyantimicrobials<a class="anchor" aria-label="anchor" href="#arg-col-keyantimicrobials"></a></dt>
|
||
<dd><p>(only useful when <code>method = "phenotype-based"</code>) column name of the key antimicrobials to determine first isolates, see <code><a href="key_antimicrobials.html">key_antimicrobials()</a></code>. The default is the first column that starts with 'key' followed by 'ab' or 'antibiotics' or 'antimicrobials' (case insensitive). Use <code>col_keyantimicrobials = FALSE</code> to prevent this. Can also be the output of <code><a href="key_antimicrobials.html">key_antimicrobials()</a></code>.</p></dd>
|
||
|
||
|
||
<dt id="arg-episode-days">episode_days<a class="anchor" aria-label="anchor" href="#arg-episode-days"></a></dt>
|
||
<dd><p>episode in days after which a genus/species combination will be determined as 'first isolate' again. The default of 365 days is based on the guideline by CLSI, see <em>Source</em>.</p></dd>
|
||
|
||
|
||
<dt id="arg-testcodes-exclude">testcodes_exclude<a class="anchor" aria-label="anchor" href="#arg-testcodes-exclude"></a></dt>
|
||
<dd><p>a <a href="https://rdrr.io/r/base/character.html" class="external-link">character</a> vector with test codes that should be excluded (case-insensitive)</p></dd>
|
||
|
||
|
||
<dt id="arg-icu-exclude">icu_exclude<a class="anchor" aria-label="anchor" href="#arg-icu-exclude"></a></dt>
|
||
<dd><p>a <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a> to indicate whether ICU isolates should be excluded (rows with value <code>TRUE</code> in the column set with <code>col_icu</code>)</p></dd>
|
||
|
||
|
||
<dt id="arg-specimen-group">specimen_group<a class="anchor" aria-label="anchor" href="#arg-specimen-group"></a></dt>
|
||
<dd><p>value in the column set with <code>col_specimen</code> to filter on</p></dd>
|
||
|
||
|
||
<dt id="arg-type">type<a class="anchor" aria-label="anchor" href="#arg-type"></a></dt>
|
||
<dd><p>type to determine weighed isolates; can be <code>"keyantimicrobials"</code> or <code>"points"</code>, see <em>Details</em></p></dd>
|
||
|
||
|
||
<dt id="arg-method">method<a class="anchor" aria-label="anchor" href="#arg-method"></a></dt>
|
||
<dd><p>the method to apply, either <code>"phenotype-based"</code>, <code>"episode-based"</code>, <code>"patient-based"</code> or <code>"isolate-based"</code> (can be abbreviated), see <em>Details</em>. The default is <code>"phenotype-based"</code> if antimicrobial test results are present in the data, and <code>"episode-based"</code> otherwise.</p></dd>
|
||
|
||
|
||
<dt id="arg-ignore-i">ignore_I<a class="anchor" aria-label="anchor" href="#arg-ignore-i"></a></dt>
|
||
<dd><p><a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a> to indicate whether antibiotic interpretations with <code>"I"</code> will be ignored when <code>type = "keyantimicrobials"</code>, see <em>Details</em></p></dd>
|
||
|
||
|
||
<dt id="arg-points-threshold">points_threshold<a class="anchor" aria-label="anchor" href="#arg-points-threshold"></a></dt>
|
||
<dd><p>minimum number of points to require before differences in the antibiogram will lead to inclusion of an isolate when <code>type = "points"</code>, see <em>Details</em></p></dd>
|
||
|
||
|
||
<dt id="arg-info">info<a class="anchor" aria-label="anchor" href="#arg-info"></a></dt>
|
||
<dd><p>a <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a> to indicate info should be printed - the default is <code>TRUE</code> only in interactive mode</p></dd>
|
||
|
||
|
||
<dt id="arg-include-unknown">include_unknown<a class="anchor" aria-label="anchor" href="#arg-include-unknown"></a></dt>
|
||
<dd><p>a <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a> to indicate whether 'unknown' microorganisms should be included too, i.e. microbial code <code>"UNKNOWN"</code>, which defaults to <code>FALSE</code>. For WHONET users, this means that all records with organism code <code>"con"</code> (<em>contamination</em>) will be excluded at default. Isolates with a microbial ID of <code>NA</code> will always be excluded as first isolate.</p></dd>
|
||
|
||
|
||
<dt id="arg-include-untested-sir">include_untested_sir<a class="anchor" aria-label="anchor" href="#arg-include-untested-sir"></a></dt>
|
||
<dd><p>a <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a> to indicate whether also rows without antibiotic results are still eligible for becoming a first isolate. Use <code>include_untested_sir = FALSE</code> to always return <code>FALSE</code> for such rows. This checks the data set for columns of class <code>sir</code> and consequently requires transforming columns with antibiotic results using <code><a href="as.sir.html">as.sir()</a></code> first.</p></dd>
|
||
|
||
|
||
<dt id="arg--">...<a class="anchor" aria-label="anchor" href="#arg--"></a></dt>
|
||
<dd><p>arguments passed on to <code>first_isolate()</code> when using <code>filter_first_isolate()</code>, otherwise arguments passed on to <code><a href="key_antimicrobials.html">key_antimicrobials()</a></code> (such as <code>universal</code>, <code>gram_negative</code>, <code>gram_positive</code>)</p></dd>
|
||
|
||
</dl></div>
|
||
<div class="section level2">
|
||
<h2 id="value">Value<a class="anchor" aria-label="anchor" href="#value"></a></h2>
|
||
<p>A <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a> vector</p>
|
||
</div>
|
||
<div class="section level2">
|
||
<h2 id="details">Details<a class="anchor" aria-label="anchor" href="#details"></a></h2>
|
||
<p>To conduct epidemiological analyses on antimicrobial resistance data, only so-called first isolates should be included to prevent overestimation and underestimation of antimicrobial resistance. Different methods can be used to do so, see below.</p>
|
||
<p>These functions are context-aware. This means that the <code>x</code> argument can be left blank if used inside a <a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a> call, see <em>Examples</em>.</p>
|
||
<p>The <code>first_isolate()</code> function is a wrapper around the <code><a href="get_episode.html">is_new_episode()</a></code> function, but more efficient for data sets containing microorganism codes or names.</p>
|
||
<p>All isolates with a microbial ID of <code>NA</code> will be excluded as first isolate.</p><div class="section">
|
||
<h3 id="different-methods">Different methods<a class="anchor" aria-label="anchor" href="#different-methods"></a></h3>
|
||
|
||
|
||
<p>According to Hindler <em>et al.</em> (2007, <a href="https://doi.org/10.1086/511864" class="external-link">doi:10.1086/511864</a>
|
||
), there are different methods (algorithms) to select first isolates with increasing reliability: isolate-based, patient-based, episode-based and phenotype-based. All methods select on a combination of the taxonomic genus and species (not subspecies).</p>
|
||
<p>All mentioned methods are covered in the <code>first_isolate()</code> function:</p><table class="table table"><tr><td><strong>Method</strong></td><td><strong>Function to apply</strong></td></tr><tr><td><strong>Isolate-based</strong></td><td><code>first_isolate(x, method = "isolate-based")</code></td></tr><tr><td><em>(= all isolates)</em></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td><strong>Patient-based</strong></td><td><code>first_isolate(x, method = "patient-based")</code></td></tr><tr><td><em>(= first isolate per patient)</em></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td><strong>Episode-based</strong></td><td><code>first_isolate(x, method = "episode-based")</code>, or:</td></tr><tr><td><em>(= first isolate per episode)</em></td><td></td></tr><tr><td>- 7-Day interval from initial isolate</td><td>- <code>first_isolate(x, method = "e", episode_days = 7)</code></td></tr><tr><td>- 30-Day interval from initial isolate</td><td>- <code>first_isolate(x, method = "e", episode_days = 30)</code></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td><strong>Phenotype-based</strong></td><td><code>first_isolate(x, method = "phenotype-based")</code>, or:</td></tr><tr><td><em>(= first isolate per phenotype)</em></td><td></td></tr><tr><td>- Major difference in any antimicrobial result</td><td>- <code>first_isolate(x, type = "points")</code></td></tr><tr><td>- Any difference in key antimicrobial results</td><td>- <code>first_isolate(x, type = "keyantimicrobials")</code></td></tr></table></div>
|
||
|
||
<div class="section">
|
||
<h3 id="isolate-based">Isolate-based<a class="anchor" aria-label="anchor" href="#isolate-based"></a></h3>
|
||
|
||
|
||
<p>This method does not require any selection, as all isolates should be included. It does, however, respect all arguments set in the <code>first_isolate()</code> function. For example, the default setting for <code>include_unknown</code> (<code>FALSE</code>) will omit selection of rows without a microbial ID.</p>
|
||
</div>
|
||
|
||
<div class="section">
|
||
<h3 id="patient-based">Patient-based<a class="anchor" aria-label="anchor" href="#patient-based"></a></h3>
|
||
|
||
|
||
<p>To include every genus-species combination per patient once, set the <code>episode_days</code> to <code>Inf</code>. Although often inappropriate, this method makes sure that no duplicate isolates are selected from the same patient. In a large longitudinal data set, this could mean that isolates are <em>excluded</em> that were found years after the initial isolate.</p>
|
||
</div>
|
||
|
||
<div class="section">
|
||
<h3 id="episode-based">Episode-based<a class="anchor" aria-label="anchor" href="#episode-based"></a></h3>
|
||
|
||
|
||
<p>To include every genus-species combination per patient episode once, set the <code>episode_days</code> to a sensible number of days. Depending on the type of analysis, this could be 14, 30, 60 or 365. Short episodes are common for analysing specific hospital or ward data, long episodes are common for analysing regional and national data.</p>
|
||
<p>This is the most common method to correct for duplicate isolates. Patients are categorised into episodes based on their ID and dates (e.g., the date of specimen receipt or laboratory result). While this is a common method, it does not take into account antimicrobial test results. This means that e.g. a methicillin-resistant <em>Staphylococcus aureus</em> (MRSA) isolate cannot be differentiated from a wildtype <em>Staphylococcus aureus</em> isolate.</p>
|
||
</div>
|
||
|
||
<div class="section">
|
||
<h3 id="phenotype-based">Phenotype-based<a class="anchor" aria-label="anchor" href="#phenotype-based"></a></h3>
|
||
|
||
|
||
<p>This is a more reliable method, since it also <em>weighs</em> the antibiogram (antimicrobial test results) yielding so-called 'first weighted isolates'. There are two different methods to weigh the antibiogram:</p><ol><li><p>Using <code>type = "points"</code> and argument <code>points_threshold</code> (default)</p>
|
||
<p>This method weighs <em>all</em> antimicrobial drugs available in the data set. Any difference from I to S or R (or vice versa) counts as <code>0.5</code> points, a difference from S to R (or vice versa) counts as <code>1</code> point. When the sum of points exceeds <code>points_threshold</code>, which defaults to <code>2</code>, an isolate will be selected as a first weighted isolate.</p>
|
||
<p>All antimicrobials are internally selected using the <code><a href="key_antimicrobials.html">all_antimicrobials()</a></code> function. The output of this function does not need to be passed to the <code>first_isolate()</code> function.</p></li>
|
||
<li><p>Using <code>type = "keyantimicrobials"</code> and argument <code>ignore_I</code></p>
|
||
<p>This method only weighs specific antimicrobial drugs, called <em>key antimicrobials</em>. Any difference from S to R (or vice versa) in these key antimicrobials will select an isolate as a first weighted isolate. With <code>ignore_I = FALSE</code>, also differences from I to S or R (or vice versa) will lead to this.</p>
|
||
<p>Key antimicrobials are internally selected using the <code><a href="key_antimicrobials.html">key_antimicrobials()</a></code> function, but can also be added manually as a variable to the data and set in the <code>col_keyantimicrobials</code> argument. Another option is to pass the output of the <code><a href="key_antimicrobials.html">key_antimicrobials()</a></code> function directly to the <code>col_keyantimicrobials</code> argument.</p></li>
|
||
</ol><p>The default method is phenotype-based (using <code>type = "points"</code>) and episode-based (using <code>episode_days = 365</code>). This makes sure that every genus-species combination is selected per patient once per year, while taking into account all antimicrobial test results. If no antimicrobial test results are available in the data set, only the episode-based method is applied at default.</p>
|
||
</div>
|
||
|
||
</div>
|
||
<div class="section level2">
|
||
<h2 id="see-also">See also<a class="anchor" aria-label="anchor" href="#see-also"></a></h2>
|
||
<div class="dont-index"><p><code><a href="key_antimicrobials.html">key_antimicrobials()</a></code></p></div>
|
||
</div>
|
||
|
||
<div class="section level2">
|
||
<h2 id="ref-examples">Examples<a class="anchor" aria-label="anchor" href="#ref-examples"></a></h2>
|
||
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="co"># `example_isolates` is a data set available in the AMR package.</span></span></span>
|
||
<span class="r-in"><span><span class="co"># See ?example_isolates.</span></span></span>
|
||
<span class="r-in"><span></span></span>
|
||
<span class="r-in"><span><span class="va">example_isolates</span><span class="op">[</span><span class="fu">first_isolate</span><span class="op">(</span>info <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span>, <span class="op">]</span></span></span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ Determining first isolates using an episode length of 365 days</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ Using column 'date' as input for col_date.</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ Using column 'patient' as input for col_patient_id.</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ Basing inclusion on all antimicrobial results, using a points threshold</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> of 2</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ Excluding 16 isolates with a microbial ID 'UNKNOWN' (in column 'mo')</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> => Found 1,387 'phenotype-based' first isolates (69.4% of total where a</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> microbial ID was available)</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># A tibble: 1,387 × 46</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> date patient age gender ward mo PEN OXA FLC AMX </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494; font-style: italic;"><date></span> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><dbl></span> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><mo></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 1</span> 2002-01-02 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 2</span> 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 3</span> 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 4</span> 2002-01-16 067927 45 F ICU B_STPHY_EPDR R NA R NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 5</span> 2002-01-17 858515 79 F ICU B_STPHY_EPDR R NA S NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 6</span> 2002-01-17 495616 67 M Clinical B_STPHY_EPDR R NA S NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 7</span> 2002-01-19 738003 71 M Clinical B_ESCHR_COLI R NA NA NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 8</span> 2002-01-21 462081 75 F Clinical B_CTRBC_FRND R NA NA R </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 9</span> 2002-01-22 F35553 50 M ICU B_PROTS_MRBL R NA NA NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">10</span> 2002-02-03 481442 76 M ICU B_STPHY_CONS R NA S NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># ℹ 1,377 more rows</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># ℹ 36 more variables: AMC <sir>, AMP <sir>, TZP <sir>, CZO <sir>, FEP <sir>,</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># CXM <sir>, FOX <sir>, CTX <sir>, CAZ <sir>, CRO <sir>, GEN <sir>,</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># TOB <sir>, AMK <sir>, KAN <sir>, TMP <sir>, SXT <sir>, NIT <sir>,</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># FOS <sir>, LNZ <sir>, CIP <sir>, MFX <sir>, VAN <sir>, TEC <sir>,</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># TCY <sir>, TGC <sir>, DOX <sir>, ERY <sir>, CLI <sir>, AZM <sir>,</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># IPM <sir>, MEM <sir>, MTR <sir>, CHL <sir>, COL <sir>, MUP <sir>, …</span></span>
|
||
<span class="r-in"><span><span class="co"># \donttest{</span></span></span>
|
||
<span class="r-in"><span><span class="co"># get all first Gram-negatives</span></span></span>
|
||
<span class="r-in"><span><span class="va">example_isolates</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/which.html" class="external-link">which</a></span><span class="op">(</span><span class="fu">first_isolate</span><span class="op">(</span>info <span class="op">=</span> <span class="cn">FALSE</span><span class="op">)</span> <span class="op">&</span> <span class="fu"><a href="mo_property.html">mo_is_gram_negative</a></span><span class="op">(</span><span class="op">)</span><span class="op">)</span>, <span class="op">]</span></span></span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ Using column 'mo' as input for mo_is_gram_negative()</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># A tibble: 441 × 46</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> date patient age gender ward mo PEN OXA FLC AMX </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494; font-style: italic;"><date></span> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><dbl></span> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><mo></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 1</span> 2002-01-02 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 2</span> 2002-01-19 738003 71 M Clinical B_ESCHR_COLI R NA NA NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 3</span> 2002-01-21 462081 75 F Clinical B_CTRBC_FRND R NA NA R </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 4</span> 2002-01-22 F35553 50 M ICU B_PROTS_MRBL R NA NA NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 5</span> 2002-02-05 067927 45 F ICU B_SERRT_MRCS R NA NA R </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 6</span> 2002-02-27 066895 85 F Clinical B_KLBSL_PNMN R NA NA R </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 7</span> 2002-03-08 4FC193 69 M Clinical B_ESCHR_COLI R NA NA R </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 8</span> 2002-03-16 4FC193 69 M Clinical B_PSDMN_AERG R NA NA R </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 9</span> 2002-04-01 496896 46 F ICU B_ESCHR_COLI R NA NA NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">10</span> 2002-04-23 EE2510 69 F ICU B_ESCHR_COLI R NA NA NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># ℹ 431 more rows</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># ℹ 36 more variables: AMC <sir>, AMP <sir>, TZP <sir>, CZO <sir>, FEP <sir>,</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># CXM <sir>, FOX <sir>, CTX <sir>, CAZ <sir>, CRO <sir>, GEN <sir>,</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># TOB <sir>, AMK <sir>, KAN <sir>, TMP <sir>, SXT <sir>, NIT <sir>,</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># FOS <sir>, LNZ <sir>, CIP <sir>, MFX <sir>, VAN <sir>, TEC <sir>,</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># TCY <sir>, TGC <sir>, DOX <sir>, ERY <sir>, CLI <sir>, AZM <sir>,</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># IPM <sir>, MEM <sir>, MTR <sir>, CHL <sir>, COL <sir>, MUP <sir>, …</span></span>
|
||
<span class="r-in"><span></span></span>
|
||
<span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">require</a></span><span class="op">(</span><span class="st"><a href="https://dplyr.tidyverse.org" class="external-link">"dplyr"</a></span><span class="op">)</span><span class="op">)</span> <span class="op">{</span></span></span>
|
||
<span class="r-in"><span> <span class="co"># filter on first isolates using dplyr:</span></span></span>
|
||
<span class="r-in"><span> <span class="va">example_isolates</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%>%</a></span></span></span>
|
||
<span class="r-in"><span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/filter.html" class="external-link">filter</a></span><span class="op">(</span><span class="fu">first_isolate</span><span class="op">(</span>info <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span><span class="op">)</span></span></span>
|
||
<span class="r-in"><span><span class="op">}</span></span></span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ Determining first isolates using an episode length of 365 days</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ Basing inclusion on all antimicrobial results, using a points threshold</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> of 2</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ Excluding 16 isolates with a microbial ID 'UNKNOWN' (in column 'mo')</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> => Found 1,387 'phenotype-based' first isolates (69.4% of total where a</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> microbial ID was available)</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># A tibble: 1,387 × 46</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> date patient age gender ward mo PEN OXA FLC AMX </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494; font-style: italic;"><date></span> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><dbl></span> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><mo></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 1</span> 2002-01-02 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 2</span> 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 3</span> 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 4</span> 2002-01-16 067927 45 F ICU B_STPHY_EPDR R NA R NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 5</span> 2002-01-17 858515 79 F ICU B_STPHY_EPDR R NA S NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 6</span> 2002-01-17 495616 67 M Clinical B_STPHY_EPDR R NA S NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 7</span> 2002-01-19 738003 71 M Clinical B_ESCHR_COLI R NA NA NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 8</span> 2002-01-21 462081 75 F Clinical B_CTRBC_FRND R NA NA R </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 9</span> 2002-01-22 F35553 50 M ICU B_PROTS_MRBL R NA NA NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">10</span> 2002-02-03 481442 76 M ICU B_STPHY_CONS R NA S NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># ℹ 1,377 more rows</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># ℹ 36 more variables: AMC <sir>, AMP <sir>, TZP <sir>, CZO <sir>, FEP <sir>,</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># CXM <sir>, FOX <sir>, CTX <sir>, CAZ <sir>, CRO <sir>, GEN <sir>,</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># TOB <sir>, AMK <sir>, KAN <sir>, TMP <sir>, SXT <sir>, NIT <sir>,</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># FOS <sir>, LNZ <sir>, CIP <sir>, MFX <sir>, VAN <sir>, TEC <sir>,</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># TCY <sir>, TGC <sir>, DOX <sir>, ERY <sir>, CLI <sir>, AZM <sir>,</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># IPM <sir>, MEM <sir>, MTR <sir>, CHL <sir>, COL <sir>, MUP <sir>, …</span></span>
|
||
<span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">require</a></span><span class="op">(</span><span class="st"><a href="https://dplyr.tidyverse.org" class="external-link">"dplyr"</a></span><span class="op">)</span><span class="op">)</span> <span class="op">{</span></span></span>
|
||
<span class="r-in"><span> <span class="co"># short-hand version:</span></span></span>
|
||
<span class="r-in"><span> <span class="va">example_isolates</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%>%</a></span></span></span>
|
||
<span class="r-in"><span> <span class="fu">filter_first_isolate</span><span class="op">(</span>info <span class="op">=</span> <span class="cn">FALSE</span><span class="op">)</span></span></span>
|
||
<span class="r-in"><span><span class="op">}</span></span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># A tibble: 1,387 × 46</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> date patient age gender ward mo PEN OXA FLC AMX </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494; font-style: italic;"><date></span> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><dbl></span> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><mo></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 1</span> 2002-01-02 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 2</span> 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 3</span> 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 4</span> 2002-01-16 067927 45 F ICU B_STPHY_EPDR R NA R NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 5</span> 2002-01-17 858515 79 F ICU B_STPHY_EPDR R NA S NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 6</span> 2002-01-17 495616 67 M Clinical B_STPHY_EPDR R NA S NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 7</span> 2002-01-19 738003 71 M Clinical B_ESCHR_COLI R NA NA NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 8</span> 2002-01-21 462081 75 F Clinical B_CTRBC_FRND R NA NA R </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 9</span> 2002-01-22 F35553 50 M ICU B_PROTS_MRBL R NA NA NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">10</span> 2002-02-03 481442 76 M ICU B_STPHY_CONS R NA S NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># ℹ 1,377 more rows</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># ℹ 36 more variables: AMC <sir>, AMP <sir>, TZP <sir>, CZO <sir>, FEP <sir>,</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># CXM <sir>, FOX <sir>, CTX <sir>, CAZ <sir>, CRO <sir>, GEN <sir>,</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># TOB <sir>, AMK <sir>, KAN <sir>, TMP <sir>, SXT <sir>, NIT <sir>,</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># FOS <sir>, LNZ <sir>, CIP <sir>, MFX <sir>, VAN <sir>, TEC <sir>,</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># TCY <sir>, TGC <sir>, DOX <sir>, ERY <sir>, CLI <sir>, AZM <sir>,</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># IPM <sir>, MEM <sir>, MTR <sir>, CHL <sir>, COL <sir>, MUP <sir>, …</span></span>
|
||
<span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">require</a></span><span class="op">(</span><span class="st"><a href="https://dplyr.tidyverse.org" class="external-link">"dplyr"</a></span><span class="op">)</span><span class="op">)</span> <span class="op">{</span></span></span>
|
||
<span class="r-in"><span> <span class="co"># flag the first isolates per group:</span></span></span>
|
||
<span class="r-in"><span> <span class="va">example_isolates</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%>%</a></span></span></span>
|
||
<span class="r-in"><span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html" class="external-link">group_by</a></span><span class="op">(</span><span class="va">ward</span><span class="op">)</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%>%</a></span></span></span>
|
||
<span class="r-in"><span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html" class="external-link">mutate</a></span><span class="op">(</span>first <span class="op">=</span> <span class="fu">first_isolate</span><span class="op">(</span>info <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span><span class="op">)</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%>%</a></span></span></span>
|
||
<span class="r-in"><span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html" class="external-link">select</a></span><span class="op">(</span><span class="va">ward</span>, <span class="va">date</span>, <span class="va">patient</span>, <span class="va">mo</span>, <span class="va">first</span><span class="op">)</span></span></span>
|
||
<span class="r-in"><span><span class="op">}</span></span></span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ Determining first isolates using an episode length of 365 days</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ Basing inclusion on all antimicrobial results, using a points threshold</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> of 2</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> </span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> Group: ward = "Clinical"</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ Excluding 9 isolates with a microbial ID 'UNKNOWN' (in column 'mo')</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> => Found 865 'phenotype-based' first isolates (70.1% of total where a</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> microbial ID was available)</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> </span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> Group: ward = "ICU"</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ Excluding 6 isolates with a microbial ID 'UNKNOWN' (in column 'mo')</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> => Found 452 'phenotype-based' first isolates (70.0% of total where a</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> microbial ID was available)</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> </span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> Group: ward = "Outpatient"</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ Excluding 1 isolates with a microbial ID 'UNKNOWN' (in column 'mo')</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> => Found 99 'phenotype-based' first isolates (82.5% of total where a</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> microbial ID was available)</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># A tibble: 2,000 × 5</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># Groups: ward [3]</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> ward date patient mo first</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><date></span> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><mo></span> <span style="color: #949494; font-style: italic;"><lgl></span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 1</span> Clinical 2002-01-02 A77334 B_ESCHR_COLI TRUE </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 2</span> Clinical 2002-01-03 A77334 B_ESCHR_COLI FALSE</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 3</span> ICU 2002-01-07 067927 B_STPHY_EPDR TRUE </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 4</span> ICU 2002-01-07 067927 B_STPHY_EPDR FALSE</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 5</span> ICU 2002-01-13 067927 B_STPHY_EPDR FALSE</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 6</span> ICU 2002-01-13 067927 B_STPHY_EPDR FALSE</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 7</span> Clinical 2002-01-14 462729 B_STPHY_AURS TRUE </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 8</span> Clinical 2002-01-14 462729 B_STPHY_AURS FALSE</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 9</span> ICU 2002-01-16 067927 B_STPHY_EPDR TRUE </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">10</span> ICU 2002-01-17 858515 B_STPHY_EPDR TRUE </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># ℹ 1,990 more rows</span></span>
|
||
<span class="r-in"><span><span class="co"># }</span></span></span>
|
||
</code></pre></div>
|
||
</div>
|
||
</main><aside class="col-md-3"><nav id="toc" aria-label="Table of contents"><h2>On this page</h2>
|
||
</nav></aside></div>
|
||
|
||
|
||
<footer><div class="pkgdown-footer-left">
|
||
<p><code>AMR</code> (for R). Free and open-source, licenced under the <a target="_blank" href="https://github.com/msberends/AMR/blob/main/LICENSE" class="external-link">GNU General Public License version 2.0 (GPL-2)</a>.<br>Developed at the <a target="_blank" href="https://www.rug.nl" class="external-link">University of Groningen</a> and <a target="_blank" href="https://www.umcg.nl" class="external-link">University Medical Center Groningen</a> in The Netherlands.</p>
|
||
</div>
|
||
|
||
<div class="pkgdown-footer-right">
|
||
<p><a target="_blank" href="https://www.rug.nl" class="external-link"><img src="https://github.com/msberends/AMR/raw/main/pkgdown/assets/logo_rug.svg" style="max-width: 150px;"></a><a target="_blank" href="https://www.umcg.nl" class="external-link"><img src="https://github.com/msberends/AMR/raw/main/pkgdown/assets/logo_umcg.svg" style="max-width: 150px;"></a></p>
|
||
</div>
|
||
|
||
</footer></div>
|
||
|
||
|
||
|
||
|
||
|
||
</body></html>
|
||
|