#' Use \code{mo_renamed()} to get a vector with all values that could be coerced based on an old, previously accepted taxonomic name.
#'
#' \strong{Microbial prevalence of pathogens in humans} \cr
#' The intelligent rules takes into account microbial prevalence of pathogens in humans. It uses three groups and all (sub)species are in only one group. These groups are:
#' The intelligent rules take into account microbial prevalence of pathogens in humans. It uses three groups and all (sub)species are in only one group. These groups are:
#' \itemize{
#' \item{1 (most prevalent): class is Gammaproteobacteria \strong{or} genus is one of: \emph{Enterococcus}, \emph{Staphylococcus}, \emph{Streptococcus}.}
#' \item{2: phylum is one of: Proteobacteria, Firmicutes, Actinobacteria, Sarcomastigophora \strong{or} genus is one of: \emph{Aspergillus}, \emph{Bacteroides}, \emph{Candida}, \emph{Capnocytophaga}, \emph{Chryseobacterium}, \emph{Cryptococcus}, \emph{Elisabethkingia}, \emph{Flavobacterium}, \emph{Fusobacterium}, \emph{Giardia}, \emph{Leptotrichia}, \emph{Mycoplasma}, \emph{Prevotella}, \emph{Rhodotorula}, \emph{Treponema}, \emph{Trichophyton}, \emph{Ureaplasma}.}
#' \item{3 (least prevalent): all others.}
#' }
#'
#' Group 1 contains all common Gram negatives, like all Enterobacteriaceae and e.g. \emph{Pseudomonas} and \emph{Legionella}.
#' Group 1 contains all common Gram positives and Gram negatives, like all Enterobacteriaceae and e.g. \emph{Pseudomonas} and \emph{Legionella}.
#'
#' Group 2 probably contains all other microbial pathogens ever found in humans.
#' Group 2 probably contains less microbial pathogens; all other members of phyla that were found in humans in the Northern Netherlands between 2001 and 2018.
#' @inheritSection catalogue_of_life Catalogue of Life
# (source as a section, so it can be inherited by other man pages)
# (source as a section here, so it can be inherited by other man pages:)
#' Use these functions to return a specific property of a microorganism from the \code{\link{microorganisms}} data set. All input values will be evaluated internally with \code{\link{as.mo}}.
#' @param x any (vector of) text that can be coerced to a valid microorganism code with \code{\link{as.mo}}
#' @param property one of the column names of one of the \code{\link{microorganisms}} data set or \code{"shortname"}
#' @param property one of the column names of the \code{\link{microorganisms}} data set or \code{"shortname"}
#' @param language language of the returned text, defaults to system language (see \code{\link{get_locale}}) and can also be set with \code{\link{getOption}("AMR_locale")}. Use \code{language = NULL} or \code{language = ""} to prevent translation.
#' @param ... other parameters passed on to \code{\link{as.mo}}
#' @param open browse the URL using \code{\link[utils]{browseURL}()}
#' @details All functions will return the most recently known taxonomic property according to the Catalogue of Life, except for \code{mo_ref}, \code{mo_authors} and \code{mo_year}. This leads to the following results:
#' \itemize{
#' \item{\code{mo_fullname("Chlamydia psittaci")} will return \code{"Chlamydophila psittaci"} (with a warning about the renaming)}
#' \item{\code{mo_name("Chlamydia psittaci")} will return \code{"Chlamydophila psittaci"} (with a warning about the renaming)}
#' \item{\code{mo_ref("Chlamydia psittaci")} will return \code{"Page, 1968"} (with a warning about the renaming)}
#' \item{\code{mo_ref("Chlamydophila psittaci")} will return \code{"Everett et al., 1999"} (without a warning)}
<p><strong>Note:</strong> values on this page will change with every website update since they are based on randomly created values and the page was written in <ahref="https://rmarkdown.rstudio.com/">R Markdown</a>. However, the methodology remains unchanged. This page was generated on 17 May 2019.</p>
<p><strong>Note:</strong> values on this page will change with every website update since they are based on randomly created values and the page was written in <ahref="https://rmarkdown.rstudio.com/">R Markdown</a>. However, the methodology remains unchanged. This page was generated on 20 May 2019.</p>
<ahref="#cleaning-the-data"class="anchor"></a>Cleaning the data</h1>
<p>Use the frequency table function <code><ahref="../reference/freq.html">freq()</a></code> to look specifically for unique values in any variable. For example, for the <code>gender</code> variable:</p>
<divclass="sourceCode"id="cb10"><preclass="sourceCode r"><codeclass="sourceCode r"><aclass="sourceLine"id="cb10-1"title="1">data <spanclass="op">%>%</span><spanclass="st"></span><spanclass="kw"><ahref="../reference/freq.html">freq</a></span>(gender) <spanclass="co"># this would be the same: freq(data$gender)</span></a></code></pre></div>
<pre><code>#> Frequency table of `gender` from a data.frame (20,000 x 9)
<p>So, we can draw at least two conclusions immediately. From a data scientist perspective, the data looks clean: only values <code>M</code> and <code>F</code>. From a researcher perspective: there are slightly more men. Nothing we didnโt already know.</p>
<p>The data is already quite clean, but we still need to transform some variables. The <code>bacteria</code> column now consists of text, and we want to add more variables based on microbial IDs later on. So, we will transform this column to valid IDs. The <code><ahref="https://dplyr.tidyverse.org/reference/mutate.html">mutate()</a></code> function of the <code>dplyr</code> package makes this really easy:</p>
<p>Finally, we will apply <ahref="http://www.eucast.org/expert_rules_and_intrinsic_resistance/">EUCAST rules</a> on our antimicrobial results. In Europe, most medical microbiological laboratories already apply these rules. Our package features their latest insights on intrinsic resistance and exceptional phenotypes. Moreover, the <code><ahref="../reference/eucast_rules.html">eucast_rules()</a></code> function can also apply additional rules, like forcing <helptitle="ATC: J01CA01">ampicillin</help> = R when <helptitle="ATC: J01CR02">amoxicillin/clavulanic acid</help> = R.</p>
<p>Because the amoxicillin (column <code>AMX</code>) and amoxicillin/clavulanic acid (column <code>AMC</code>) in our data were generated randomly, some rows will undoubtedly contain AMX = S and AMC = R, which is technically impossible. The <code><ahref="../reference/eucast_rules.html">eucast_rules()</a></code> fixes this:</p>
<aclass="sourceLine"id="cb14-3"title="3"><spanclass="co">#> Rules by the European Committee on Antimicrobial Susceptibility Testing (EUCAST)</span></a>
<aclass="sourceLine"id="cb14-25"title="25"><spanclass="co">#> Table 01: Intrinsic resistance in Enterobacteriaceae (1304 new changes)</span></a>
<aclass="sourceLine"id="cb14-26"title="26"><spanclass="co">#> Table 02: Intrinsic resistance in non-fermentative Gram-negative bacteria (no new changes)</span></a>
<aclass="sourceLine"id="cb14-27"title="27"><spanclass="co">#> Table 03: Intrinsic resistance in other Gram-negative bacteria (no new changes)</span></a>
<aclass="sourceLine"id="cb14-28"title="28"><spanclass="co">#> Table 04: Intrinsic resistance in Gram-positive bacteria (2729 new changes)</span></a>
<aclass="sourceLine"id="cb14-29"title="29"><spanclass="co">#> Table 08: Interpretive rules for B-lactam agents and Gram-positive cocci (no new changes)</span></a>
<aclass="sourceLine"id="cb14-30"title="30"><spanclass="co">#> Table 09: Interpretive rules for B-lactam agents and Gram-negative rods (no new changes)</span></a>
<aclass="sourceLine"id="cb14-31"title="31"><spanclass="co">#> Table 11: Interpretive rules for macrolides, lincosamides, and streptogramins (no new changes)</span></a>
<aclass="sourceLine"id="cb14-32"title="32"><spanclass="co">#> Table 12: Interpretive rules for aminoglycosides (no new changes)</span></a>
<aclass="sourceLine"id="cb14-33"title="33"><spanclass="co">#> Table 13: Interpretive rules for quinolones (no new changes)</span></a>
<aclass="sourceLine"id="cb14-35"title="35"><spanclass="co">#> Other rules</span></a>
<aclass="sourceLine"id="cb14-36"title="36"><spanclass="co">#> Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2235 new changes)</span></a>
<aclass="sourceLine"id="cb14-37"title="37"><spanclass="co">#> Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (125 new changes)</span></a>
<aclass="sourceLine"id="cb14-38"title="38"><spanclass="co">#> Non-EUCAST: piperacillin = R where piperacillin/tazobactam = R (no new changes)</span></a>
<aclass="sourceLine"id="cb14-39"title="39"><spanclass="co">#> Non-EUCAST: piperacillin/tazobactam = S where piperacillin = S (no new changes)</span></a>
<aclass="sourceLine"id="cb14-40"title="40"><spanclass="co">#> Non-EUCAST: trimethoprim = R where trimethoprim/sulfa = R (no new changes)</span></a>
<aclass="sourceLine"id="cb14-41"title="41"><spanclass="co">#> Non-EUCAST: trimethoprim/sulfa = S where trimethoprim = S (no new changes)</span></a>
<aclass="sourceLine"id="cb14-44"title="44"><spanclass="co">#> EUCAST rules affected 6,510 out of 20,000 rows, making a total of 7,874 edits</span></a>
<aclass="sourceLine"id="cb14-45"title="45"><spanclass="co">#> => added 0 test results</span></a>
<aclass="sourceLine"id="cb14-56"title="56"><spanclass="co">#> Use verbose = TRUE to get a data.frame with all specified edits instead.</span></a></code></pre></div>
<aclass="sourceLine"id="cb14-25"title="25"><spanclass="co"># Table 01: Intrinsic resistance in Enterobacteriaceae (1367 new changes)</span></a>
<aclass="sourceLine"id="cb14-26"title="26"><spanclass="co"># Table 02: Intrinsic resistance in non-fermentative Gram-negative bacteria (no new changes)</span></a>
<aclass="sourceLine"id="cb14-27"title="27"><spanclass="co"># Table 03: Intrinsic resistance in other Gram-negative bacteria (no new changes)</span></a>
<aclass="sourceLine"id="cb14-28"title="28"><spanclass="co"># Table 04: Intrinsic resistance in Gram-positive bacteria (2649 new changes)</span></a>
<aclass="sourceLine"id="cb14-29"title="29"><spanclass="co"># Table 08: Interpretive rules for B-lactam agents and Gram-positive cocci (no new changes)</span></a>
<aclass="sourceLine"id="cb14-30"title="30"><spanclass="co"># Table 09: Interpretive rules for B-lactam agents and Gram-negative rods (no new changes)</span></a>
<aclass="sourceLine"id="cb14-31"title="31"><spanclass="co"># Table 11: Interpretive rules for macrolides, lincosamides, and streptogramins (no new changes)</span></a>
<aclass="sourceLine"id="cb14-32"title="32"><spanclass="co"># Table 12: Interpretive rules for aminoglycosides (no new changes)</span></a>
<aclass="sourceLine"id="cb14-33"title="33"><spanclass="co"># Table 13: Interpretive rules for quinolones (no new changes)</span></a>
<aclass="sourceLine"id="cb14-35"title="35"><spanclass="co"># Other rules</span></a>
<aclass="sourceLine"id="cb14-36"title="36"><spanclass="co"># Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2211 new changes)</span></a>
<aclass="sourceLine"id="cb14-37"title="37"><spanclass="co"># Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (107 new changes)</span></a>
<aclass="sourceLine"id="cb14-38"title="38"><spanclass="co"># Non-EUCAST: piperacillin = R where piperacillin/tazobactam = R (no new changes)</span></a>
<aclass="sourceLine"id="cb14-39"title="39"><spanclass="co"># Non-EUCAST: piperacillin/tazobactam = S where piperacillin = S (no new changes)</span></a>
<aclass="sourceLine"id="cb14-40"title="40"><spanclass="co"># Non-EUCAST: trimethoprim = R where trimethoprim/sulfa = R (no new changes)</span></a>
<aclass="sourceLine"id="cb14-41"title="41"><spanclass="co"># Non-EUCAST: trimethoprim/sulfa = S where trimethoprim = S (no new changes)</span></a>
<aclass="sourceLine"id="cb14-56"title="56"><spanclass="co"># Use verbose = TRUE to get a data.frame with all specified edits instead.</span></a></code></pre></div>
<p>This <code>AMR</code> package includes this methodology with the <code><ahref="../reference/first_isolate.html">first_isolate()</a></code> function. It adopts the episode of a year (can be changed by user) and it starts counting days after every selected isolate. This new variable can easily be added to our data:</p>
<aclass="sourceLine"id="cb16-3"title="3"><spanclass="co">#></span><spanclass="al">NOTE</span><spanclass="co">: Using column `bacteria` as input for `col_mo`.</span></a>
<aclass="sourceLine"id="cb16-4"title="4"><spanclass="co">#></span><spanclass="al">NOTE</span><spanclass="co">: Using column `date` as input for `col_date`.</span></a>
<aclass="sourceLine"id="cb16-5"title="5"><spanclass="co">#></span><spanclass="al">NOTE</span><spanclass="co">: Using column `patient_id` as input for `col_patient_id`.</span></a>
<aclass="sourceLine"id="cb16-6"title="6"><spanclass="co">#> => Found 5,686 first isolates (28.4% of total)</span></a></code></pre></div>
<p>So only 28.4% is suitable for resistance analysis! We can now filter on it with the <code><ahref="https://dplyr.tidyverse.org/reference/filter.html">filter()</a></code> function, also from the <code>dplyr</code> package:</p>
<aclass="sourceLine"id="cb16-3"title="3"><spanclass="co"># </span><spanclass="al">NOTE</span><spanclass="co">: Using column `bacteria` as input for `col_mo`.</span></a>
<aclass="sourceLine"id="cb16-4"title="4"><spanclass="co"># </span><spanclass="al">NOTE</span><spanclass="co">: Using column `date` as input for `col_date`.</span></a>
<aclass="sourceLine"id="cb16-5"title="5"><spanclass="co"># </span><spanclass="al">NOTE</span><spanclass="co">: Using column `patient_id` as input for `col_patient_id`.</span></a>
<aclass="sourceLine"id="cb16-6"title="6"><spanclass="co"># => Found 5,692 first isolates (28.5% of total)</span></a></code></pre></div>
<p>So only 28.5% is suitable for resistance analysis! We can now filter on it with the <code><ahref="https://dplyr.tidyverse.org/reference/filter.html">filter()</a></code> function, also from the <code>dplyr</code> package:</p>
<p>For future use, the above two syntaxes can be shortened with the <code><ahref="../reference/first_isolate.html">filter_first_isolate()</a></code> function:</p>
<aclass="sourceLine"id="cb19-4"title="4"><spanclass="co">#></span><spanclass="al">NOTE</span><spanclass="co">: Using column `bacteria` as input for `col_mo`.</span></a>
<aclass="sourceLine"id="cb19-5"title="5"><spanclass="co">#></span><spanclass="al">NOTE</span><spanclass="co">: Using column `bacteria` as input for `col_mo`.</span></a>
<aclass="sourceLine"id="cb19-6"title="6"><spanclass="co">#></span><spanclass="al">NOTE</span><spanclass="co">: Using column `date` as input for `col_date`.</span></a>
<aclass="sourceLine"id="cb19-7"title="7"><spanclass="co">#></span><spanclass="al">NOTE</span><spanclass="co">: Using column `patient_id` as input for `col_patient_id`.</span></a>
<aclass="sourceLine"id="cb19-8"title="8"><spanclass="co">#></span><spanclass="al">NOTE</span><spanclass="co">: Using column `keyab` as input for `col_keyantibiotics`. Use col_keyantibiotics = FALSE to prevent this.</span></a>
<aclass="sourceLine"id="cb19-9"title="9"><spanclass="co">#> [Criterion] Inclusion based on key antibiotics, ignoring I.</span></a>
<aclass="sourceLine"id="cb19-10"title="10"><spanclass="co">#> => Found 15,158 first weighted isolates (75.8% of total)</span></a></code></pre></div>
<aclass="sourceLine"id="cb19-4"title="4"><spanclass="co"># </span><spanclass="al">NOTE</span><spanclass="co">: Using column `bacteria` as input for `col_mo`.</span></a>
<aclass="sourceLine"id="cb19-5"title="5"><spanclass="co"># </span><spanclass="al">NOTE</span><spanclass="co">: Using column `bacteria` as input for `col_mo`.</span></a>
<aclass="sourceLine"id="cb19-6"title="6"><spanclass="co"># </span><spanclass="al">NOTE</span><spanclass="co">: Using column `date` as input for `col_date`.</span></a>
<aclass="sourceLine"id="cb19-7"title="7"><spanclass="co"># </span><spanclass="al">NOTE</span><spanclass="co">: Using column `patient_id` as input for `col_patient_id`.</span></a>
<aclass="sourceLine"id="cb19-8"title="8"><spanclass="co"># </span><spanclass="al">NOTE</span><spanclass="co">: Using column `keyab` as input for `col_keyantibiotics`. Use col_keyantibiotics = FALSE to prevent this.</span></a>
<aclass="sourceLine"id="cb19-9"title="9"><spanclass="co"># [Criterion] Inclusion based on key antibiotics, ignoring I.</span></a>
<aclass="sourceLine"id="cb19-10"title="10"><spanclass="co"># => Found 15,100 first weighted isolates (75.5% of total)</span></a></code></pre></div>