1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-25 18:46:11 +01:00

(v0.6.1.9053) prerelease fixes

This commit is contained in:
dr. M.S. (Matthijs) Berends 2019-06-02 19:23:19 +02:00
parent 8de0495008
commit bd73988f15
38 changed files with 337 additions and 327 deletions

View File

@ -1,6 +1,6 @@
Package: AMR
Version: 0.6.1.9052
Date: 2019-06-01
Version: 0.6.1.9053
Date: 2019-06-02
Title: Antimicrobial Resistance Analysis
Authors@R: c(
person(

View File

@ -1,5 +1,4 @@
# AMR 0.6.1.9052
**Note: latest development version**
# AMR 0.6.1.9053
#### New
* Support for translation of disk diffusion and MIC values to RSI values (i.e. antimicrobial interpretations). Supported guidelines are EUCAST (2011 to 2019) and CLSI (2011 to 2019). Use `as.rsi()` on an MIC value (created with `as.mic()`), a disk diffusion value (created with the new `as.disk()`) or on a complete date set containing columns with MIC or disk diffusion values.
@ -30,7 +29,8 @@
* Removed deprecated functions `guess_mo()`, `guess_atc()`, `EUCAST_rules()`, `interpretive_reading()`, `rsi()`
* Frequency tables (`freq()`):
* speed improvement for microbial IDs
* fixed level names in markdown
* fixed factor level names for R Markdown
* when all values are unique it now shows a message instead of a warning
* support for boxplots:
```r
septic_patients %>%
@ -51,6 +51,7 @@
* Fix for `first_isolate()` for when dates are missing
* Improved speed of `guess_ab_col()`
* Function `as.mo()` now gently interprets any number of whitespace characters (like tabs) as one space
* Function `as.mo()` now returns `UNKNOWN` for `"con"` (WHONET ID of 'contamination') and returns `NA` for `"xxx"`(WHONET ID of 'no growth')
* Small algorithm fix for `as.mo()`
* Removed viruses from data set `microorganisms.codes` and cleaned it up
* Fix for `mo_shortname()` where species would not be determined correctly

View File

@ -45,7 +45,7 @@
#' @section Authors:
#' Matthijs S. Berends[1,2] Christian F. Luz[1], Erwin E.A. Hassing[2], Corinna Glasner[1], Alex W. Friedrich[1], Bhanu N.M. Sinha[1] \cr
#'
#' [1] Department of Medical Microbiology, University of Groningen, University Medical Center Groningen, Groningen, the Netherlands - \url{rug.nl} \url{umcg.nl} \cr
#' [1] Department of Medical Microbiology, University of Groningen, University Medical Center Groningen, Groningen, the Netherlands - \url{https://www.rug.nl} \url{https://www.umcg.nl} \cr
#' [2] Certe Medical Diagnostics & Advice, Groningen, the Netherlands - \url{certe.nl}
#' @section Read more on our website!:

View File

@ -40,7 +40,7 @@
#'
#' The Catalogue of Life (\url{http://www.catalogueoflife.org}) is the most comprehensive and authoritative global index of species currently available. It holds essential information on the names, relationships and distributions of over 1.6 million species. The Catalogue of Life is used to support the major biodiversity and conservation information services such as the Global Biodiversity Information Facility (GBIF), Encyclopedia of Life (EoL) and the International Union for Conservation of Nature Red List. It is recognised by the Convention on Biological Diversity as a significant component of the Global Taxonomy Initiative and a contribution to Target 1 of the Global Strategy for Plant Conservation.
#'
#' The syntax used to transform the original data to a cleansed R format, can be found here: \url{https://gitlab.com/msberends/AMR/blob/master/reproduction_of_microorganisms.R}.
#' The syntax used to transform the original data to a cleansed R format, can be found here: \url{https://gitlab.com/msberends/AMR/blob/master/data-raw/reproduction_of_microorganisms.R}.
#' @inheritSection AMR Read more on our website!
#' @name catalogue_of_life
#' @rdname catalogue_of_life

View File

@ -59,16 +59,9 @@
#' \describe{
#' \item{\code{mo}}{ID of microorganism as used by this package}
#' \item{\code{col_id}}{Catalogue of Life ID}
#' \item{\code{fullname}}{Full name, like \code{"Echerichia coli"}}
#' \item{\code{kingdom}}{Taxonomic kingdom of the microorganism}
#' \item{\code{phylum}}{Taxonomic phylum of the microorganism}
#' \item{\code{class}}{Taxonomic class of the microorganism}
#' \item{\code{order}}{Taxonomic order of the microorganism}
#' \item{\code{family}}{Taxonomic family of the microorganism}
#' \item{\code{genus}}{Taxonomic genus of the microorganism}
#' \item{\code{species}}{Taxonomic species of the microorganism}
#' \item{\code{subspecies}}{Taxonomic subspecies of the microorganism}
#' \item{\code{rank}}{Taxonomic rank of the microorganism, like \code{"species"} or \code{"genus"}}
#' \item{\code{fullname}}{Full name, like \code{"Escherichia coli"}}
#' \item{\code{kingdom}, \code{phylum}, \code{class}, \code{order}, \code{family}, \code{genus}, \code{species}, \code{subspecies}}{Taxonomic rank of the microorganism}
#' \item{\code{rank}}{Text of the taxonomic rank of the microorganism, like \code{"species"} or \code{"genus"}}
#' \item{\code{ref}}{Author(s) and year of concerning scientific publication}
#' \item{\code{species_id}}{ID of the species as used by the Catalogue of Life}
#' \item{\code{source}}{Either \code{"CoL"}, \code{"DSMZ"} (see source) or "manually added"}
@ -119,7 +112,7 @@ catalogue_of_life <- list(
#' Translation table for microorganism codes
#'
#' A data set containing commonly used codes for microorganisms, from laboratory systems and WHONET. Define your own with \code{\link{set_mo_source}}.
#' @format A \code{\link{data.frame}} with 5,171 observations and 2 variables:
#' @format A \code{\link{data.frame}} with 4,969 observations and 2 variables:
#' \describe{
#' \item{\code{certe}}{Commonly used code of a microorganism}
#' \item{\code{mo}}{ID of the microorganism in the \code{\link{microorganisms}} data set}

View File

@ -342,7 +342,7 @@ freq <- function(x,
# mult.columns <- 2
} else {
x.name <- deparse(substitute(x))
if (x.name %like% "[$]") {
if (all(x.name %like% "[$]") & length(x.name) == 1) {
cols <- unlist(strsplit(x.name, "$", fixed = TRUE))[2]
x.name <- unlist(strsplit(x.name, "$", fixed = TRUE))[1]
# try to find the object to determine dimensions
@ -710,7 +710,8 @@ format_header <- function(x, markdown = FALSE, decimal.mark = ".", big.mark = ",
})
# numeric values
if (has_length == TRUE & any(x_class %in% c("double", "integer", "numeric", "raw", "single"))) {
if (has_length == TRUE & !is.null(header$sd)) {
# any(x_class %in% c("double", "integer", "numeric", "raw", "single"))) {
header$sd <- paste0(header$sd, " (CV: ", header$cv, ", MAD: ", header$mad, ")")
header$fivenum <- paste0(paste(trimws(header$fivenum), collapse = " | "), " (IQR: ", header$IQR, ", CQV: ", header$cqv, ")")
header$outliers_total <- paste0(header$outliers_total, " (unique count: ", header$outliers_unique, ")")
@ -1018,9 +1019,11 @@ print.freq <- function(x,
} else {
opt$column_names <- opt$column_names[!opt$column_names == "Item"]
}
all_unique <- FALSE
if ("count" %in% colnames(x)) {
if (all(x$count == 1)) {
warning("All observations are unique.", call. = FALSE)
all_unique <- TRUE
}
x$count <- format(x$count, decimal.mark = opt$decimal.mark, big.mark = opt$big.mark)
} else {
@ -1072,6 +1075,10 @@ print.freq <- function(x,
cat("\n")
}
if (all_unique == TRUE) {
message("NOTE: All observations are unique.")
}
# reset old kable setting
options(knitr.kable.NA = opt.old)
return(invisible())

29
R/mo.R
View File

@ -195,10 +195,11 @@ as.mo <- function(x, Becker = FALSE, Lancefield = FALSE, allow_uncertain = TRUE,
# check onLoad() in R/zzz.R: data tables are created there.
}
x[x == ""] <- NA_character_
# WHONET: xxx = no growth
x[tolower(as.character(paste0(x, ""))) %in% c("", "xxx", "na", "nan")] <- NA_character_
uncertainty_level <- translate_allow_uncertain(allow_uncertain)
mo_hist <- get_mo_history(x, uncertainty_level, force = isTRUE(list(...)$force_mo_history))
# mo_hist <- get_mo_history(x, uncertainty_level, force = isTRUE(list(...)$force_mo_history))
if (mo_source_isvalid(reference_df)
& isFALSE(Becker)
@ -231,11 +232,11 @@ as.mo <- function(x, Becker = FALSE, Lancefield = FALSE, allow_uncertain = TRUE,
& isFALSE(Lancefield)) {
y <- x
} else if (!any(is.na(mo_hist))
& isFALSE(Becker)
& isFALSE(Lancefield)) {
# check previously found results
y <- mo_hist
# } else if (!any(is.na(mo_hist))
# & isFALSE(Becker)
# & isFALSE(Lancefield)) {
# # check previously found results
# y <- mo_hist
} else if (all(tolower(x) %in% microorganismsDT$fullname_lower)
& isFALSE(Becker)
@ -299,7 +300,8 @@ exec_as.mo <- function(x,
# check onLoad() in R/zzz.R: data tables are created there.
}
x[x == ""] <- NA_character_
# WHONET: xxx = no growth
x[tolower(as.character(paste0(x, ""))) %in% c("", "xxx", "na", "nan")] <- NA_character_
if (initial_search == TRUE) {
options(mo_failures = NULL)
@ -340,12 +342,11 @@ exec_as.mo <- function(x,
# only check the uniques, which is way faster
x <- unique(x)
# remove empty values (to later fill them in again with NAs)
# ("xxx" is WHONET code for 'no growth' and "con" is WHONET code for 'contamination')
# ("xxx" is WHONET code for 'no growth')
x <- x[!is.na(x)
& !is.null(x)
& !identical(x, "")
& !identical(x, "xxx")
& !identical(x, "con")]
& !identical(x, "xxx")]
# conversion of old MO codes from v0.5.0 (ITIS) to later versions (Catalogue of Life)
if (any(x %like% "^[BFP]_[A-Z]{3,7}") & !all(x %in% microorganisms$mo)) {
@ -560,7 +561,8 @@ exec_as.mo <- function(x,
next
}
if (any(tolower(x_backup_without_spp[i]) %in% c(NA, "", "xxx", "con", "na", "nan"))) {
# WHONET: xxx = no growth
if (tolower(as.character(paste0(x_backup_without_spp[i], ""))) %in% c("", "xxx", "na", "nan")) {
x[i] <- NA_character_
next
}
@ -1273,8 +1275,7 @@ exec_as.mo <- function(x,
x_input_unique_nonempty <- unique(x_input[!is.na(x_input)
& !is.null(x_input)
& !identical(x_input, "")
& !identical(x_input, "xxx")
& !identical(x_input, "con")])
& !identical(x_input, "xxx")])
# left join the found results to the original input values (x_input)
df_found <- data.frame(input = as.character(x_input_unique_nonempty),

View File

@ -78,7 +78,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">0.6.1.9052</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.6.1.9053</span>
</span>
</div>

View File

@ -40,7 +40,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">0.6.1.9052</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.6.1.9053</span>
</span>
</div>
@ -199,7 +199,7 @@
<h1>How to conduct AMR analysis</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">01 June 2019</h4>
<h4 class="date">02 June 2019</h4>
<div class="hidden name"><code>AMR.Rmd</code></div>
@ -208,7 +208,7 @@
<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 <a href="https://rmarkdown.rstudio.com/">R Markdown</a>. However, the methodology remains unchanged. This page was generated on 01 June 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 <a href="https://rmarkdown.rstudio.com/">R Markdown</a>. However, the methodology remains unchanged. This page was generated on 02 June 2019.</p>
<div id="introduction" class="section level1">
<h1 class="hasAnchor">
<a href="#introduction" class="anchor"></a>Introduction</h1>
@ -224,21 +224,21 @@
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2019-06-01</td>
<td align="center">2019-06-02</td>
<td align="center">abcd</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">S</td>
</tr>
<tr class="even">
<td align="center">2019-06-01</td>
<td align="center">2019-06-02</td>
<td align="center">abcd</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">R</td>
</tr>
<tr class="odd">
<td align="center">2019-06-01</td>
<td align="center">2019-06-02</td>
<td align="center">efgh</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
@ -249,7 +249,7 @@
<div id="needed-r-packages" class="section level2">
<h2 class="hasAnchor">
<a href="#needed-r-packages" class="anchor"></a>Needed R packages</h2>
<p>As with many uses in R, we need some additional packages for AMR analysis. Our package works closely together with the <a href="https://www.tidyverse.org">tidyverse packages</a> <a href="https://dplyr.tidyverse.org/"><code>dplyr</code></a> and <a href="https://ggplot2.tidyverse.org"><code>ggplot2</code></a> by <a href="https://www.linkedin.com/in/hadleywickham/">Dr Hadley Wickham</a>. The tidyverse tremendously improves the way we conduct data science - it allows for a very natural way of writing syntaxes and creating beautiful plots in R.</p>
<p>As with many uses in R, we need some additional packages for AMR analysis. Our package works closely together with the <a href="https://www.tidyverse.org">tidyverse packages</a> <a href="https://dplyr.tidyverse.org/"><code>dplyr</code></a> and <a href="https://ggplot2.tidyverse.org"><code>ggplot2</code></a> by Dr Hadley Wickham. The tidyverse tremendously improves the way we conduct data science - it allows for a very natural way of writing syntaxes and creating beautiful plots in R.</p>
<p>Our <code>AMR</code> package depends on these packages and even extends their use and functions.</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(dplyr)</a>
<a class="sourceLine" id="cb1-2" title="2"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(ggplot2)</a>
@ -334,10 +334,10 @@
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2011-01-05</td>
<td align="center">W4</td>
<td align="center">2014-06-27</td>
<td align="center">V8</td>
<td align="center">Hospital B</td>
<td align="center">Escherichia coli</td>
<td align="center">Klebsiella pneumoniae</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
@ -345,19 +345,41 @@
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2013-05-10</td>
<td align="center">W2</td>
<td align="center">2013-02-12</td>
<td align="center">L4</td>
<td align="center">Hospital A</td>
<td align="center">Streptococcus pneumoniae</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="odd">
<td align="center">2013-11-26</td>
<td align="center">T2</td>
<td align="center">Hospital A</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2013-12-27</td>
<td align="center">J10</td>
<td align="center">Hospital A</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="odd">
<td align="center">2011-07-24</td>
<td align="center">L6</td>
<td align="center">2013-09-22</td>
<td align="center">I7</td>
<td align="center">Hospital C</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">S</td>
@ -367,38 +389,16 @@
<td align="center">M</td>
</tr>
<tr class="even">
<td align="center">2017-12-18</td>
<td align="center">P2</td>
<td align="center">Hospital B</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">2014-01-26</td>
<td align="center">Q6</td>
<td align="center">Hospital A</td>
<td align="center">Klebsiella pneumoniae</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="odd">
<td align="center">2017-03-27</td>
<td align="center">I8</td>
<td align="center">Hospital D</td>
<td align="center">Klebsiella pneumoniae</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="even">
<td align="center">2013-05-25</td>
<td align="center">L4</td>
<td align="center">Hospital A</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
</tbody>
</table>
<p>Now, lets start the cleaning and the analysis!</p>
@ -418,8 +418,8 @@
#
# Item Count Percent Cum. Count Cum. Percent
# --- ----- ------- -------- ----------- -------------
# 1 M 10,472 52.4% 10,472 52.4%
# 2 F 9,528 47.6% 20,000 100.0%</code></pre>
# 1 M 10,233 51.2% 10,233 51.2%
# 2 F 9,767 48.8% 20,000 100.0%</code></pre>
<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 didnt 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><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate()</a></code> function of the <code>dplyr</code> package makes this really easy:</p>
<div class="sourceCode" id="cb12"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb12-1" title="1">data &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span></a>
@ -449,14 +449,14 @@
<a class="sourceLine" id="cb14-18" title="18"><span class="co"># Pasteurella multocida (no new changes)</span></a>
<a class="sourceLine" id="cb14-19" title="19"><span class="co"># Staphylococcus (no new changes)</span></a>
<a class="sourceLine" id="cb14-20" title="20"><span class="co"># Streptococcus groups A, B, C, G (no new changes)</span></a>
<a class="sourceLine" id="cb14-21" title="21"><span class="co"># Streptococcus pneumoniae (1519 new changes)</span></a>
<a class="sourceLine" id="cb14-21" title="21"><span class="co"># Streptococcus pneumoniae (1509 new changes)</span></a>
<a class="sourceLine" id="cb14-22" title="22"><span class="co"># Viridans group streptococci (no new changes)</span></a>
<a class="sourceLine" id="cb14-23" title="23"><span class="co"># </span></a>
<a class="sourceLine" id="cb14-24" title="24"><span class="co"># EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes (v3.1, 2016)</span></a>
<a class="sourceLine" id="cb14-25" title="25"><span class="co"># Table 01: Intrinsic resistance in Enterobacteriaceae (1280 new changes)</span></a>
<a class="sourceLine" id="cb14-25" title="25"><span class="co"># Table 01: Intrinsic resistance in Enterobacteriaceae (1276 new changes)</span></a>
<a class="sourceLine" id="cb14-26" title="26"><span class="co"># Table 02: Intrinsic resistance in non-fermentative Gram-negative bacteria (no new changes)</span></a>
<a class="sourceLine" id="cb14-27" title="27"><span class="co"># Table 03: Intrinsic resistance in other Gram-negative bacteria (no new changes)</span></a>
<a class="sourceLine" id="cb14-28" title="28"><span class="co"># Table 04: Intrinsic resistance in Gram-positive bacteria (2810 new changes)</span></a>
<a class="sourceLine" id="cb14-28" title="28"><span class="co"># Table 04: Intrinsic resistance in Gram-positive bacteria (2758 new changes)</span></a>
<a class="sourceLine" id="cb14-29" title="29"><span class="co"># Table 08: Interpretive rules for B-lactam agents and Gram-positive cocci (no new changes)</span></a>
<a class="sourceLine" id="cb14-30" title="30"><span class="co"># Table 09: Interpretive rules for B-lactam agents and Gram-negative rods (no new changes)</span></a>
<a class="sourceLine" id="cb14-31" title="31"><span class="co"># Table 11: Interpretive rules for macrolides, lincosamides, and streptogramins (no new changes)</span></a>
@ -464,24 +464,24 @@
<a class="sourceLine" id="cb14-33" title="33"><span class="co"># Table 13: Interpretive rules for quinolones (no new changes)</span></a>
<a class="sourceLine" id="cb14-34" title="34"><span class="co"># </span></a>
<a class="sourceLine" id="cb14-35" title="35"><span class="co"># Other rules</span></a>
<a class="sourceLine" id="cb14-36" title="36"><span class="co"># Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2266 new changes)</span></a>
<a class="sourceLine" id="cb14-37" title="37"><span class="co"># Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (95 new changes)</span></a>
<a class="sourceLine" id="cb14-36" title="36"><span class="co"># Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2254 new changes)</span></a>
<a class="sourceLine" id="cb14-37" title="37"><span class="co"># Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (138 new changes)</span></a>
<a class="sourceLine" id="cb14-38" title="38"><span class="co"># Non-EUCAST: piperacillin = R where piperacillin/tazobactam = R (no new changes)</span></a>
<a class="sourceLine" id="cb14-39" title="39"><span class="co"># Non-EUCAST: piperacillin/tazobactam = S where piperacillin = S (no new changes)</span></a>
<a class="sourceLine" id="cb14-40" title="40"><span class="co"># Non-EUCAST: trimethoprim = R where trimethoprim/sulfa = R (no new changes)</span></a>
<a class="sourceLine" id="cb14-41" title="41"><span class="co"># Non-EUCAST: trimethoprim/sulfa = S where trimethoprim = S (no new changes)</span></a>
<a class="sourceLine" id="cb14-42" title="42"><span class="co"># </span></a>
<a class="sourceLine" id="cb14-43" title="43"><span class="co"># --------------------------------------------------------------------------</span></a>
<a class="sourceLine" id="cb14-44" title="44"><span class="co"># EUCAST rules affected 6,560 out of 20,000 rows, making a total of 7,970 edits</span></a>
<a class="sourceLine" id="cb14-44" title="44"><span class="co"># EUCAST rules affected 6,564 out of 20,000 rows, making a total of 7,935 edits</span></a>
<a class="sourceLine" id="cb14-45" title="45"><span class="co"># =&gt; added 0 test results</span></a>
<a class="sourceLine" id="cb14-46" title="46"><span class="co"># </span></a>
<a class="sourceLine" id="cb14-47" title="47"><span class="co"># =&gt; changed 7,970 test results</span></a>
<a class="sourceLine" id="cb14-48" title="48"><span class="co"># - 118 test results changed from S to I</span></a>
<a class="sourceLine" id="cb14-49" title="49"><span class="co"># - 4,807 test results changed from S to R</span></a>
<a class="sourceLine" id="cb14-50" title="50"><span class="co"># - 1,119 test results changed from I to S</span></a>
<a class="sourceLine" id="cb14-51" title="51"><span class="co"># - 318 test results changed from I to R</span></a>
<a class="sourceLine" id="cb14-52" title="52"><span class="co"># - 1,590 test results changed from R to S</span></a>
<a class="sourceLine" id="cb14-53" title="53"><span class="co"># - 18 test results changed from R to I</span></a>
<a class="sourceLine" id="cb14-47" title="47"><span class="co"># =&gt; changed 7,935 test results</span></a>
<a class="sourceLine" id="cb14-48" title="48"><span class="co"># - 109 test results changed from S to I</span></a>
<a class="sourceLine" id="cb14-49" title="49"><span class="co"># - 4,768 test results changed from S to R</span></a>
<a class="sourceLine" id="cb14-50" title="50"><span class="co"># - 1,081 test results changed from I to S</span></a>
<a class="sourceLine" id="cb14-51" title="51"><span class="co"># - 345 test results changed from I to R</span></a>
<a class="sourceLine" id="cb14-52" title="52"><span class="co"># - 1,615 test results changed from R to S</span></a>
<a class="sourceLine" id="cb14-53" title="53"><span class="co"># - 17 test results changed from R to I</span></a>
<a class="sourceLine" id="cb14-54" title="54"><span class="co"># --------------------------------------------------------------------------</span></a>
<a class="sourceLine" id="cb14-55" title="55"><span class="co"># </span></a>
<a class="sourceLine" id="cb14-56" title="56"><span class="co"># Use verbose = TRUE to get a data.frame with all specified edits instead.</span></a></code></pre></div>
@ -509,8 +509,8 @@
<a class="sourceLine" id="cb16-3" title="3"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `bacteria` as input for `col_mo`.</span></a>
<a class="sourceLine" id="cb16-4" title="4"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `date` as input for `col_date`.</span></a>
<a class="sourceLine" id="cb16-5" title="5"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `patient_id` as input for `col_patient_id`.</span></a>
<a class="sourceLine" id="cb16-6" title="6"><span class="co"># =&gt; Found 5,704 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><a href="https://dplyr.tidyverse.org/reference/filter.html">filter()</a></code> function, also from the <code>dplyr</code> package:</p>
<a class="sourceLine" id="cb16-6" title="6"><span class="co"># =&gt; Found 5,664 first isolates (28.3% of total)</span></a></code></pre></div>
<p>So only 28.3% is suitable for resistance analysis! We can now filter on it with the <code><a href="https://dplyr.tidyverse.org/reference/filter.html">filter()</a></code> function, also from the <code>dplyr</code> package:</p>
<div class="sourceCode" id="cb17"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb17-1" title="1">data_1st &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb17-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span>(first <span class="op">==</span><span class="st"> </span><span class="ot">TRUE</span>)</a></code></pre></div>
<p>For future use, the above two syntaxes can be shortened with the <code><a href="../reference/first_isolate.html">filter_first_isolate()</a></code> function:</p>
@ -536,8 +536,8 @@
<tbody>
<tr class="odd">
<td align="center">1</td>
<td align="center">2010-01-23</td>
<td align="center">H6</td>
<td align="center">2010-01-07</td>
<td align="center">K9</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
@ -547,8 +547,8 @@
</tr>
<tr class="even">
<td align="center">2</td>
<td align="center">2010-03-03</td>
<td align="center">H6</td>
<td align="center">2010-02-14</td>
<td align="center">K9</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
@ -558,10 +558,10 @@
</tr>
<tr class="odd">
<td align="center">3</td>
<td align="center">2010-03-26</td>
<td align="center">H6</td>
<td align="center">2010-02-18</td>
<td align="center">K9</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
@ -569,19 +569,19 @@
</tr>
<tr class="even">
<td align="center">4</td>
<td align="center">2010-04-21</td>
<td align="center">H6</td>
<td align="center">2010-06-01</td>
<td align="center">K9</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="odd">
<td align="center">5</td>
<td align="center">2010-07-15</td>
<td align="center">H6</td>
<td align="center">2010-08-14</td>
<td align="center">K9</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
@ -591,32 +591,32 @@
</tr>
<tr class="even">
<td align="center">6</td>
<td align="center">2010-08-13</td>
<td align="center">H6</td>
<td align="center">2010-11-08</td>
<td align="center">K9</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="odd">
<td align="center">7</td>
<td align="center">2010-09-29</td>
<td align="center">H6</td>
<td align="center">2010-11-16</td>
<td align="center">K9</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="even">
<td align="center">8</td>
<td align="center">2010-10-10</td>
<td align="center">H6</td>
<td align="center">2010-12-11</td>
<td align="center">K9</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
@ -624,29 +624,29 @@
</tr>
<tr class="odd">
<td align="center">9</td>
<td align="center">2010-12-09</td>
<td align="center">H6</td>
<td align="center">2011-02-27</td>
<td align="center">K9</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">S</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">10</td>
<td align="center">2010-12-11</td>
<td align="center">H6</td>
<td align="center">2011-03-06</td>
<td align="center">K9</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
</tbody>
</table>
<p>Only 1 isolates are marked as first according to CLSI guideline. But when reviewing the antibiogram, it is obvious that some isolates are absolutely different strains and should be included too. This is why we weigh isolates, based on their antibiogram. The <code><a href="../reference/key_antibiotics.html">key_antibiotics()</a></code> function adds a vector with 18 key antibiotics: 6 broad spectrum ones, 6 small spectrum for Gram negatives and 6 small spectrum for Gram positives. These can be defined by the user.</p>
<p>Only 2 isolates are marked as first according to CLSI guideline. But when reviewing the antibiogram, it is obvious that some isolates are absolutely different strains and should be included too. This is why we weigh isolates, based on their antibiogram. The <code><a href="../reference/key_antibiotics.html">key_antibiotics()</a></code> function adds a vector with 18 key antibiotics: 6 broad spectrum ones, 6 small spectrum for Gram negatives and 6 small spectrum for Gram positives. These can be defined by the user.</p>
<p>If a column exists with a name like key(…)ab the <code><a href="../reference/first_isolate.html">first_isolate()</a></code> function will automatically use it and determine the first weighted isolates. Mind the NOTEs in below output:</p>
<div class="sourceCode" id="cb19"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb19-1" title="1">data &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb19-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="dt">keyab =</span> <span class="kw"><a href="../reference/key_antibiotics.html">key_antibiotics</a></span>(.)) <span class="op">%&gt;%</span><span class="st"> </span></a>
@ -657,7 +657,7 @@
<a class="sourceLine" id="cb19-7" title="7"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `patient_id` as input for `col_patient_id`.</span></a>
<a class="sourceLine" id="cb19-8" title="8"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `keyab` as input for `col_keyantibiotics`. Use col_keyantibiotics = FALSE to prevent this.</span></a>
<a class="sourceLine" id="cb19-9" title="9"><span class="co"># [Criterion] Inclusion based on key antibiotics, ignoring I.</span></a>
<a class="sourceLine" id="cb19-10" title="10"><span class="co"># =&gt; Found 15,183 first weighted isolates (75.9% of total)</span></a></code></pre></div>
<a class="sourceLine" id="cb19-10" title="10"><span class="co"># =&gt; Found 15,014 first weighted isolates (75.1% of total)</span></a></code></pre></div>
<table class="table">
<thead><tr class="header">
<th align="center">isolate</th>
@ -674,8 +674,8 @@
<tbody>
<tr class="odd">
<td align="center">1</td>
<td align="center">2010-01-23</td>
<td align="center">H6</td>
<td align="center">2010-01-07</td>
<td align="center">K9</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
@ -686,8 +686,8 @@
</tr>
<tr class="even">
<td align="center">2</td>
<td align="center">2010-03-03</td>
<td align="center">H6</td>
<td align="center">2010-02-14</td>
<td align="center">K9</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
@ -698,10 +698,10 @@
</tr>
<tr class="odd">
<td align="center">3</td>
<td align="center">2010-03-26</td>
<td align="center">H6</td>
<td align="center">2010-02-18</td>
<td align="center">K9</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
@ -710,20 +710,20 @@
</tr>
<tr class="even">
<td align="center">4</td>
<td align="center">2010-04-21</td>
<td align="center">H6</td>
<td align="center">2010-06-01</td>
<td align="center">K9</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">5</td>
<td align="center">2010-07-15</td>
<td align="center">H6</td>
<td align="center">2010-08-14</td>
<td align="center">K9</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
@ -734,20 +734,8 @@
</tr>
<tr class="even">
<td align="center">6</td>
<td align="center">2010-08-13</td>
<td align="center">H6</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">FALSE</td>
</tr>
<tr class="odd">
<td align="center">7</td>
<td align="center">2010-09-29</td>
<td align="center">H6</td>
<td align="center">2010-11-08</td>
<td align="center">K9</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
@ -756,37 +744,49 @@
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">7</td>
<td align="center">2010-11-16</td>
<td align="center">K9</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">8</td>
<td align="center">2010-10-10</td>
<td align="center">H6</td>
<td align="center">2010-12-11</td>
<td align="center">K9</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
<td align="center">FALSE</td>
</tr>
<tr class="odd">
<td align="center">9</td>
<td align="center">2010-12-09</td>
<td align="center">H6</td>
<td align="center">2011-02-27</td>
<td align="center">K9</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">S</td>
<td align="center">TRUE</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">10</td>
<td align="center">2010-12-11</td>
<td align="center">H6</td>
<td align="center">2011-03-06</td>
<td align="center">K9</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
@ -794,11 +794,11 @@
</tr>
</tbody>
</table>
<p>Instead of 1, now 9 isolates are flagged. In total, 75.9% of all isolates are marked first weighted - 47.4% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.</p>
<p>Instead of 2, now 9 isolates are flagged. In total, 75.1% of all isolates are marked first weighted - 46.8% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.</p>
<p>As with <code><a href="../reference/first_isolate.html">filter_first_isolate()</a></code>, theres a shortcut for this new algorithm too:</p>
<div class="sourceCode" id="cb20"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb20-1" title="1">data_1st &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb20-2" title="2"><span class="st"> </span><span class="kw"><a href="../reference/first_isolate.html">filter_first_weighted_isolate</a></span>()</a></code></pre></div>
<p>So we end up with 15,183 isolates for analysis.</p>
<p>So we end up with 15,014 isolates for analysis.</p>
<p>We can remove unneeded columns:</p>
<div class="sourceCode" id="cb21"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb21-1" title="1">data_1st &lt;-<span class="st"> </span>data_1st <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb21-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(<span class="op">-</span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(first, keyab))</a></code></pre></div>
@ -824,28 +824,44 @@
<tbody>
<tr class="odd">
<td>1</td>
<td align="center">2011-01-05</td>
<td align="center">W4</td>
<td align="center">2014-06-27</td>
<td align="center">V8</td>
<td align="center">Hospital B</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">B_KLBSL_PNE</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">Gram negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">Klebsiella</td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td>2</td>
<td align="center">2013-05-10</td>
<td align="center">W2</td>
<td align="center">2013-02-12</td>
<td align="center">L4</td>
<td align="center">Hospital A</td>
<td align="center">B_STRPT_PNE</td>
<td align="center">I</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">M</td>
<td align="center">Gram positive</td>
<td align="center">Streptococcus</td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td>3</td>
<td align="center">2013-11-26</td>
<td align="center">T2</td>
<td align="center">Hospital A</td>
<td align="center">B_STPHY_AUR</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
@ -854,29 +870,13 @@
<td align="center">aureus</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td>4</td>
<td align="center">2017-12-18</td>
<td align="center">P2</td>
<td align="center">Hospital B</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">Gram negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td>6</td>
<td align="center">2013-05-25</td>
<td align="center">L4</td>
<td align="center">Hospital A</td>
<td>5</td>
<td align="center">2013-09-22</td>
<td align="center">I7</td>
<td align="center">Hospital C</td>
<td align="center">B_STPHY_AUR</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
@ -888,28 +888,28 @@
</tr>
<tr class="odd">
<td>7</td>
<td align="center">2016-09-17</td>
<td align="center">F3</td>
<td align="center">Hospital D</td>
<td align="center">B_KLBSL_PNE</td>
<td align="center">R</td>
<td align="center">2012-03-30</td>
<td align="center">L8</td>
<td align="center">Hospital B</td>
<td align="center">B_STPHY_AUR</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">Gram negative</td>
<td align="center">Klebsiella</td>
<td align="center">pneumoniae</td>
<td align="center">Gram positive</td>
<td align="center">Staphylococcus</td>
<td align="center">aureus</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td>8</td>
<td align="center">2010-06-30</td>
<td align="center">L8</td>
<td align="center">Hospital B</td>
<td align="center">2015-08-27</td>
<td align="center">L4</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
@ -935,9 +935,9 @@
<div class="sourceCode" id="cb23"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb23-1" title="1"><span class="kw"><a href="../reference/freq.html">freq</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/paste">paste</a></span>(data_1st<span class="op">$</span>genus, data_1st<span class="op">$</span>species))</a></code></pre></div>
<p>Or can be used like the <code>dplyr</code> way, which is easier readable:</p>
<div class="sourceCode" id="cb24"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb24-1" title="1">data_1st <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(genus, species)</a></code></pre></div>
<p><strong>Frequency table of <code>genus</code> and <code>species</code> from a <code>data.frame</code> (15,183 x 13)</strong></p>
<p><strong>Frequency table of <code>genus</code> and <code>species</code> from a <code>data.frame</code> (15,014 x 13)</strong></p>
<p>Columns: 2<br>
Length: 15,183 (of which NA: 0 = 0.00%)<br>
Length: 15,014 (of which NA: 0 = 0.00%)<br>
Unique: 4</p>
<p>Shortest: 16<br>
Longest: 24</p>
@ -954,33 +954,33 @@ Longest: 24</p>
<tr class="odd">
<td align="left">1</td>
<td align="left">Escherichia coli</td>
<td align="right">7,416</td>
<td align="right">48.8%</td>
<td align="right">7,416</td>
<td align="right">48.8%</td>
<td align="right">7,496</td>
<td align="right">49.9%</td>
<td align="right">7,496</td>
<td align="right">49.9%</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">Staphylococcus aureus</td>
<td align="right">3,781</td>
<td align="right">24.9%</td>
<td align="right">11,197</td>
<td align="right">73.7%</td>
<td align="right">3,663</td>
<td align="right">24.4%</td>
<td align="right">11,159</td>
<td align="right">74.3%</td>
</tr>
<tr class="odd">
<td align="left">3</td>
<td align="left">Streptococcus pneumoniae</td>
<td align="right">2,391</td>
<td align="right">15.7%</td>
<td align="right">13,588</td>
<td align="right">89.5%</td>
<td align="right">2,303</td>
<td align="right">15.3%</td>
<td align="right">13,462</td>
<td align="right">89.7%</td>
</tr>
<tr class="even">
<td align="left">4</td>
<td align="left">Klebsiella pneumoniae</td>
<td align="right">1,595</td>
<td align="right">10.5%</td>
<td align="right">15,183</td>
<td align="right">1,552</td>
<td align="right">10.3%</td>
<td align="right">15,014</td>
<td align="right">100.0%</td>
</tr>
</tbody>
@ -991,7 +991,7 @@ Longest: 24</p>
<a href="#resistance-percentages" class="anchor"></a>Resistance percentages</h2>
<p>The functions <code><a href="../reference/portion.html">portion_S()</a></code>, <code><a href="../reference/portion.html">portion_SI()</a></code>, <code><a href="../reference/portion.html">portion_I()</a></code>, <code><a href="../reference/portion.html">portion_IR()</a></code> and <code><a href="../reference/portion.html">portion_R()</a></code> can be used to determine the portion of a specific antimicrobial outcome. As per the EUCAST guideline of 2019, we calculate resistance as the portion of R (<code><a href="../reference/portion.html">portion_R()</a></code>) and susceptibility as the portion of S and I (<code><a href="../reference/portion.html">portion_SI()</a></code>). These functions can be used on their own:</p>
<div class="sourceCode" id="cb25"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb25-1" title="1">data_1st <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_R</a></span>(AMX)</a>
<a class="sourceLine" id="cb25-2" title="2"><span class="co"># [1] 0.4716459</span></a></code></pre></div>
<a class="sourceLine" id="cb25-2" title="2"><span class="co"># [1] 0.4708938</span></a></code></pre></div>
<p>Or can be used in conjuction with <code><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by()</a></code> and <code><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise()</a></code>, both from the <code>dplyr</code> package:</p>
<div class="sourceCode" id="cb26"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb26-1" title="1">data_1st <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb26-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(hospital) <span class="op">%&gt;%</span><span class="st"> </span></a>
@ -1004,19 +1004,19 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Hospital A</td>
<td align="center">0.4789879</td>
<td align="center">0.4625681</td>
</tr>
<tr class="even">
<td align="center">Hospital B</td>
<td align="center">0.4752328</td>
<td align="center">0.4799232</td>
</tr>
<tr class="odd">
<td align="center">Hospital C</td>
<td align="center">0.4525453</td>
<td align="center">0.4727660</td>
</tr>
<tr class="even">
<td align="center">Hospital D</td>
<td align="center">0.4688136</td>
<td align="center">0.4660767</td>
</tr>
</tbody>
</table>
@ -1034,23 +1034,23 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Hospital A</td>
<td align="center">0.4789879</td>
<td align="center">4545</td>
<td align="center">0.4625681</td>
<td align="center">4408</td>
</tr>
<tr class="even">
<td align="center">Hospital B</td>
<td align="center">0.4752328</td>
<td align="center">5370</td>
<td align="center">0.4799232</td>
<td align="center">5205</td>
</tr>
<tr class="odd">
<td align="center">Hospital C</td>
<td align="center">0.4525453</td>
<td align="center">2318</td>
<td align="center">0.4727660</td>
<td align="center">2350</td>
</tr>
<tr class="even">
<td align="center">Hospital D</td>
<td align="center">0.4688136</td>
<td align="center">2950</td>
<td align="center">0.4660767</td>
<td align="center">3051</td>
</tr>
</tbody>
</table>
@ -1070,27 +1070,27 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Escherichia</td>
<td align="center">0.9224649</td>
<td align="center">0.8938781</td>
<td align="center">0.9920442</td>
<td align="center">0.9252935</td>
<td align="center">0.8992796</td>
<td align="center">0.9945304</td>
</tr>
<tr class="even">
<td align="center">Klebsiella</td>
<td align="center">0.8119122</td>
<td align="center">0.9072100</td>
<td align="center">0.9874608</td>
<td align="center">0.8150773</td>
<td align="center">0.9059278</td>
<td align="center">0.9864691</td>
</tr>
<tr class="odd">
<td align="center">Staphylococcus</td>
<td align="center">0.9185401</td>
<td align="center">0.9098122</td>
<td align="center">0.9920656</td>
<td align="center">0.9216489</td>
<td align="center">0.9211029</td>
<td align="center">0.9923560</td>
</tr>
<tr class="even">
<td align="center">Streptococcus</td>
<td align="center">0.6056043</td>
<td align="center">0.6026921</td>
<td align="center">0.0000000</td>
<td align="center">0.6056043</td>
<td align="center">0.6026921</td>
</tr>
</tbody>
</table>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

@ -78,7 +78,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">0.6.1.9052</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.6.1.9053</span>
</span>
</div>

View File

@ -40,7 +40,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">0.6.1.9052</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.6.1.9053</span>
</span>
</div>
@ -199,7 +199,7 @@
<h1>How to predict antimicrobial resistance</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">01 June 2019</h4>
<h4 class="date">02 June 2019</h4>
<div class="hidden name"><code>resistance_predict.Rmd</code></div>
@ -211,7 +211,7 @@
<div id="needed-r-packages" class="section level2">
<h2 class="hasAnchor">
<a href="#needed-r-packages" class="anchor"></a>Needed R packages</h2>
<p>As with many uses in R, we need some additional packages for AMR analysis. Our package works closely together with the <a href="https://www.tidyverse.org">tidyverse packages</a> <a href="https://dplyr.tidyverse.org/"><code>dplyr</code></a> and <a href="https://ggplot2.tidyverse.org"><code>ggplot2</code></a> by <a href="https://www.linkedin.com/in/hadleywickham/">Dr Hadley Wickham</a>. The tidyverse tremendously improves the way we conduct data science - it allows for a very natural way of writing syntaxes and creating beautiful plots in R.</p>
<p>As with many uses in R, we need some additional packages for AMR analysis. Our package works closely together with the <a href="https://www.tidyverse.org">tidyverse packages</a> <a href="https://dplyr.tidyverse.org/"><code>dplyr</code></a> and <a href="https://ggplot2.tidyverse.org"><code>ggplot2</code></a> by Dr Hadley Wickham. The tidyverse tremendously improves the way we conduct data science - it allows for a very natural way of writing syntaxes and creating beautiful plots in R.</p>
<p>Our <code>AMR</code> package depends on these packages and even extends their use and functions.</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(dplyr)</a>
<a class="sourceLine" id="cb1-2" title="2"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(ggplot2)</a>

View File

@ -78,7 +78,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">0.6.1.9052</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.6.1.9053</span>
</span>
</div>

View File

@ -214,3 +214,7 @@ table a:not(.btn):hover, .table a:not(.btn):hover {
#btn_collapseDisqus {
white-space: normal;
}
#search-input {
max-width: 100px;
}

View File

@ -17,7 +17,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
*/

View File

@ -42,7 +42,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">0.6.1.9052</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.6.1.9053</span>
</span>
</div>

View File

@ -78,7 +78,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">0.6.1.9052</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.6.1.9053</span>
</span>
</div>
@ -239,11 +239,10 @@
</div>
<div id="amr-0619052" class="section level1">
<div id="amr-0619053" class="section level1">
<h1 class="page-header">
<a href="#amr-0619052" class="anchor"></a>AMR 0.6.1.9052<small> Unreleased </small>
<a href="#amr-0619053" class="anchor"></a>AMR 0.6.1.9053<small> Unreleased </small>
</h1>
<p><strong>Note: latest development version</strong></p>
<div id="new" class="section level4">
<h4 class="hasAnchor">
<a href="#new" class="anchor"></a>New</h4>
@ -293,7 +292,8 @@ Please <a href="https://gitlab.com/msberends/AMR/issues/new?issue%5Btitle%5D=Tra
<li>Frequency tables (<code><a href="../reference/freq.html">freq()</a></code>):
<ul>
<li>speed improvement for microbial IDs</li>
<li>fixed level names in markdown</li>
<li>fixed factor level names for R Markdown</li>
<li>when all values are unique it now shows a message instead of a warning</li>
<li>
<p>support for boxplots:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" title="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span></a>
@ -319,6 +319,7 @@ Please <a href="https://gitlab.com/msberends/AMR/issues/new?issue%5Btitle%5D=EUC
<li>Improved speed of <code><a href="../reference/guess_ab_col.html">guess_ab_col()</a></code>
</li>
<li>Function <code><a href="../reference/as.mo.html">as.mo()</a></code> now gently interprets any number of whitespace characters (like tabs) as one space</li>
<li>Function <code><a href="../reference/as.mo.html">as.mo()</a></code> now returns <code>UNKNOWN</code> for <code>"con"</code> (WHONET ID of contamination) and returns <code>NA</code> for <code>"xxx"</code>(WHONET ID of no growth)</li>
<li>Small algorithm fix for <code><a href="../reference/as.mo.html">as.mo()</a></code>
</li>
<li>Removed viruses from data set <code>microorganisms.codes</code> and cleaned it up</li>
@ -1065,7 +1066,7 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
<div id="tocnav">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#amr-0619052">0.6.1.9052</a></li>
<li><a href="#amr-0619053">0.6.1.9053</a></li>
<li><a href="#amr-061">0.6.1</a></li>
<li><a href="#amr-060">0.6.0</a></li>
<li><a href="#amr-050">0.5.0</a></li>

View File

@ -80,7 +80,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">0.6.1.9052</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.6.1.9053</span>
</span>
</div>
@ -272,7 +272,7 @@
<p>Matthijs S. Berends[1,2] Christian F. Luz[1], Erwin E.A. Hassing[2], Corinna Glasner[1], Alex W. Friedrich[1], Bhanu N.M. Sinha[1] <br /></p>
<p>[1] Department of Medical Microbiology, University of Groningen, University Medical Center Groningen, Groningen, the Netherlands - <a href='rug.nl'>rug.nl</a> <a href='umcg.nl'>umcg.nl</a> <br />
<p>[1] Department of Medical Microbiology, University of Groningen, University Medical Center Groningen, Groningen, the Netherlands - <a href='https://www.rug.nl'>https://www.rug.nl</a> <a href='https://www.umcg.nl'>https://www.umcg.nl</a> <br />
[2] Certe Medical Diagnostics &amp; Advice, Groningen, the Netherlands - <a href='certe.nl'>certe.nl</a></p>
<h2 class="hasAnchor" id="read-more-on-our-website-"><a class="anchor" href="#read-more-on-our-website-"></a>Read more on our website!</h2>

View File

@ -80,7 +80,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">0.6.1.9052</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.6.1.9053</span>
</span>
</div>
@ -268,7 +268,7 @@ This package contains the complete taxonomic tree of almost all microorganisms (
<li><p>The responsible author(s) and year of scientific publication</p></li>
</ul>
<p>The Catalogue of Life (<a href='http://www.catalogueoflife.org'>http://www.catalogueoflife.org</a>) is the most comprehensive and authoritative global index of species currently available. It holds essential information on the names, relationships and distributions of over 1.6 million species. The Catalogue of Life is used to support the major biodiversity and conservation information services such as the Global Biodiversity Information Facility (GBIF), Encyclopedia of Life (EoL) and the International Union for Conservation of Nature Red List. It is recognised by the Convention on Biological Diversity as a significant component of the Global Taxonomy Initiative and a contribution to Target 1 of the Global Strategy for Plant Conservation.</p>
<p>The syntax used to transform the original data to a cleansed R format, can be found here: <a href='https://gitlab.com/msberends/AMR/blob/master/reproduction_of_microorganisms.R'>https://gitlab.com/msberends/AMR/blob/master/reproduction_of_microorganisms.R</a>.</p>
<p>The syntax used to transform the original data to a cleansed R format, can be found here: <a href='https://gitlab.com/msberends/AMR/blob/master/data-raw/reproduction_of_microorganisms.R'>https://gitlab.com/msberends/AMR/blob/master/data-raw/reproduction_of_microorganisms.R</a>.</p>
<h2 class="hasAnchor" id="read-more-on-our-website-"><a class="anchor" href="#read-more-on-our-website-"></a>Read more on our website!</h2>

View File

@ -80,7 +80,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">0.6.1.9052</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.6.1.9053</span>
</span>
</div>

View File

@ -78,7 +78,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">0.6.1.9052</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.6.1.9053</span>
</span>
</div>

View File

@ -80,7 +80,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">0.6.1.9052</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.6.1.9053</span>
</span>
</div>
@ -252,7 +252,7 @@
<h2 class="hasAnchor" id="format"><a class="anchor" href="#format"></a>Format</h2>
<p>A <code><a href='https://www.rdocumentation.org/packages/base/topics/data.frame'>data.frame</a></code> with 5,171 observations and 2 variables:</p><dl class='dl-horizontal'>
<p>A <code><a href='https://www.rdocumentation.org/packages/base/topics/data.frame'>data.frame</a></code> with 4,969 observations and 2 variables:</p><dl class='dl-horizontal'>
<dt><code>certe</code></dt><dd><p>Commonly used code of a microorganism</p></dd>
<dt><code>mo</code></dt><dd><p>ID of the microorganism in the <code><a href='microorganisms.html'>microorganisms</a></code> data set</p></dd>
</dl>

View File

@ -80,7 +80,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">0.6.1.9052</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.6.1.9053</span>
</span>
</div>
@ -252,24 +252,7 @@
<h2 class="hasAnchor" id="format"><a class="anchor" href="#format"></a>Format</h2>
<p>A <code><a href='https://www.rdocumentation.org/packages/base/topics/data.frame'>data.frame</a></code> with 67,903 observations and 16 variables:</p><dl class='dl-horizontal'>
<dt><code>mo</code></dt><dd><p>ID of microorganism as used by this package</p></dd>
<dt><code>col_id</code></dt><dd><p>Catalogue of Life ID</p></dd>
<dt><code>fullname</code></dt><dd><p>Full name, like <code>"Echerichia coli"</code></p></dd>
<dt><code>kingdom</code></dt><dd><p>Taxonomic kingdom of the microorganism</p></dd>
<dt><code>phylum</code></dt><dd><p>Taxonomic phylum of the microorganism</p></dd>
<dt><code>class</code></dt><dd><p>Taxonomic class of the microorganism</p></dd>
<dt><code>order</code></dt><dd><p>Taxonomic order of the microorganism</p></dd>
<dt><code>family</code></dt><dd><p>Taxonomic family of the microorganism</p></dd>
<dt><code>genus</code></dt><dd><p>Taxonomic genus of the microorganism</p></dd>
<dt><code>species</code></dt><dd><p>Taxonomic species of the microorganism</p></dd>
<dt><code>subspecies</code></dt><dd><p>Taxonomic subspecies of the microorganism</p></dd>
<dt><code>rank</code></dt><dd><p>Taxonomic rank of the microorganism, like <code>"species"</code> or <code>"genus"</code></p></dd>
<dt><code>ref</code></dt><dd><p>Author(s) and year of concerning scientific publication</p></dd>
<dt><code>species_id</code></dt><dd><p>ID of the species as used by the Catalogue of Life</p></dd>
<dt><code>source</code></dt><dd><p>Either <code>"CoL"</code>, <code>"DSMZ"</code> (see source) or "manually added"</p></dd>
<dt><code>prevalence</code></dt><dd><p>Prevalence of the microorganism, see <code><a href='as.mo.html'>?as.mo</a></code></p></dd>
</dl>
<p>An object of class <code>data.frame</code> with 67903 rows and 16 columns.</p>
<h2 class="hasAnchor" id="source"><a class="anchor" href="#source"></a>Source</h2>

View File

@ -28,7 +28,7 @@ current_commit=`git describe --tags | sed 's/.*-\(.*\)-.*/\1/'`
new_version="$current_tag.$((current_commit + 9000))" # results in 0.1.0.9040
sed -i -- "s/^Version: .*/Version: ${new_version}/" DESCRIPTION
# update 1st line of NEWS.md
sed -i -- "1s/${current_tag}.*/${new_version}/" NEWS.md
sed -i -- "1s/.*/# AMR ${new_version}/" NEWS.md
echo "First 3 lines of DESCRIPTION:"
head -3 DESCRIPTION
echo

32
git_release.sh Executable file
View File

@ -0,0 +1,32 @@
#######################################################################
# To push new commits to the premaster branch, run: #
# bash git_premaster.sh "commit message" #
# #
# After successful CRAN checks, merge it to the master branch with: #
# bash git_merge.sh #
# #
# Initiate a new release with: #
# bash git_release.sh "new_version_number" #
# This will edit the DESCRIPTION file and the NEWS.md file. #
#######################################################################
if [ -z "$1" ]; then
echo "FATAL - no version number"
exit 1
fi
echo "••••••••••••••••••••••••••••••••••••••••••••"
echo "• Updating package date and version number •"
echo "••••••••••••••••••••••••••••••••••••••••••••"
new_version=${1}
sed -i -- "s/^Version: .*/Version: ${new_version}/" DESCRIPTION
# update 1st line of NEWS.md
sed -i -- "1s/.*/# AMR ${new_version}/" NEWS.md
echo "First 3 lines of DESCRIPTION:"
head -3 DESCRIPTION
echo
echo "First line of NEWS.md:"
head -1 NEWS.md
echo
echo "Run devtools::release() or devtools::submit_cran(). Non-interactive mode (this script) will not work."

View File

@ -31,7 +31,7 @@ This package can be used for:
Matthijs S. Berends[1,2] Christian F. Luz[1], Erwin E.A. Hassing[2], Corinna Glasner[1], Alex W. Friedrich[1], Bhanu N.M. Sinha[1] \cr
[1] Department of Medical Microbiology, University of Groningen, University Medical Center Groningen, Groningen, the Netherlands - \url{rug.nl} \url{umcg.nl} \cr
[1] Department of Medical Microbiology, University of Groningen, University Medical Center Groningen, Groningen, the Netherlands - \url{https://www.rug.nl} \url{https://www.umcg.nl} \cr
[2] Certe Medical Diagnostics & Advice, Groningen, the Netherlands - \url{certe.nl}
}

View File

@ -28,7 +28,7 @@ Included are:
The Catalogue of Life (\url{http://www.catalogueoflife.org}) is the most comprehensive and authoritative global index of species currently available. It holds essential information on the names, relationships and distributions of over 1.6 million species. The Catalogue of Life is used to support the major biodiversity and conservation information services such as the Global Biodiversity Information Facility (GBIF), Encyclopedia of Life (EoL) and the International Union for Conservation of Nature Red List. It is recognised by the Convention on Biological Diversity as a significant component of the Global Taxonomy Initiative and a contribution to Target 1 of the Global Strategy for Plant Conservation.
The syntax used to transform the original data to a cleansed R format, can be found here: \url{https://gitlab.com/msberends/AMR/blob/master/reproduction_of_microorganisms.R}.
The syntax used to transform the original data to a cleansed R format, can be found here: \url{https://gitlab.com/msberends/AMR/blob/master/data-raw/reproduction_of_microorganisms.R}.
}
\section{Read more on our website!}{

View File

@ -4,25 +4,7 @@
\name{microorganisms}
\alias{microorganisms}
\title{Data set with ~65,000 microorganisms}
\format{A \code{\link{data.frame}} with 67,903 observations and 16 variables:
\describe{
\item{\code{mo}}{ID of microorganism as used by this package}
\item{\code{col_id}}{Catalogue of Life ID}
\item{\code{fullname}}{Full name, like \code{"Echerichia coli"}}
\item{\code{kingdom}}{Taxonomic kingdom of the microorganism}
\item{\code{phylum}}{Taxonomic phylum of the microorganism}
\item{\code{class}}{Taxonomic class of the microorganism}
\item{\code{order}}{Taxonomic order of the microorganism}
\item{\code{family}}{Taxonomic family of the microorganism}
\item{\code{genus}}{Taxonomic genus of the microorganism}
\item{\code{species}}{Taxonomic species of the microorganism}
\item{\code{subspecies}}{Taxonomic subspecies of the microorganism}
\item{\code{rank}}{Taxonomic rank of the microorganism, like \code{"species"} or \code{"genus"}}
\item{\code{ref}}{Author(s) and year of concerning scientific publication}
\item{\code{species_id}}{ID of the species as used by the Catalogue of Life}
\item{\code{source}}{Either \code{"CoL"}, \code{"DSMZ"} (see source) or "manually added"}
\item{\code{prevalence}}{Prevalence of the microorganism, see \code{?as.mo}}
}}
\format{An object of class \code{data.frame} with 67903 rows and 16 columns.}
\source{
Catalogue of Life: Annual Checklist (public online taxonomic database), \url{www.catalogueoflife.org} (check included annual version with \code{\link{catalogue_of_life_version}()}).

View File

@ -4,7 +4,7 @@
\name{microorganisms.codes}
\alias{microorganisms.codes}
\title{Translation table for microorganism codes}
\format{A \code{\link{data.frame}} with 5,171 observations and 2 variables:
\format{A \code{\link{data.frame}} with 4,969 observations and 2 variables:
\describe{
\item{\code{certe}}{Commonly used code of a microorganism}
\item{\code{mo}}{ID of the microorganism in the \code{\link{microorganisms}} data set}

View File

@ -214,3 +214,7 @@ table a:not(.btn):hover, .table a:not(.btn):hover {
#btn_collapseDisqus {
white-space: normal;
}
#search-input {
max-width: 100px;
}

View File

@ -17,7 +17,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
*/

View File

@ -66,7 +66,7 @@ test_that("frequency table works", {
# rsi
expect_output(print(freq(septic_patients$AMC)))
# hms
expect_output(suppressWarnings(print(freq(hms::as.hms(sample(c(0:86399), 50))))))
expect_output(print(freq(hms::as.hms(sample(c(0:86399), 50)))))
# matrix
expect_output(print(freq(as.matrix(septic_patients$age))))
expect_output(print(freq(as.matrix(septic_patients[, c("age", "gender")]))))
@ -74,10 +74,10 @@ test_that("frequency table works", {
expect_output(print(freq(list(age = septic_patients$age))))
expect_output(print(freq(list(age = septic_patients$age, gender = septic_patients$gender))))
# difftime
expect_output(suppressWarnings(print(
expect_output(print(
freq(difftime(Sys.time(),
Sys.time() - runif(5, min = 0, max = 60 * 60 * 24),
units = "hours")))))
units = "hours"))))
expect_output(print(freq(septic_patients$age)[,1:3]))

View File

@ -247,10 +247,12 @@ test_that("as.mo works", {
# summary
expect_equal(length(summary(septic_patients$mo)), 6)
# other
expect_equal(as.character(as.mo(c("xxx", "con", "na", "nan"), debug = TRUE)),
rep(NA_character_, 4))
# WHONET codes and NA/NaN
expect_equal(as.character(as.mo(c("xxx", "na", "nan"), debug = TRUE)),
rep(NA_character_, 3))
expect_equal(as.character(as.mo("con")), "UNKNOWN")
expect_equal(as.character(as.mo("xxx")), NA_character_)
expect_equal(as.character(as.mo(c("xxx", "con"))), c(NA_character_, "UNKNOWN"))
expect_equal(as.character(as.mo(c("other", "none", "unknown"))),
rep("UNKNOWN", 3))

View File

@ -42,7 +42,7 @@ knitr::kable(dplyr::tibble(date = Sys.Date(),
```
## Needed R packages
As with many uses in R, we need some additional packages for AMR analysis. Our package works closely together with the [tidyverse packages](https://www.tidyverse.org) [`dplyr`](https://dplyr.tidyverse.org/) and [`ggplot2`](https://ggplot2.tidyverse.org) by [Dr Hadley Wickham](https://www.linkedin.com/in/hadleywickham/). The tidyverse tremendously improves the way we conduct data science - it allows for a very natural way of writing syntaxes and creating beautiful plots in R.
As with many uses in R, we need some additional packages for AMR analysis. Our package works closely together with the [tidyverse packages](https://www.tidyverse.org) [`dplyr`](https://dplyr.tidyverse.org/) and [`ggplot2`](https://ggplot2.tidyverse.org) by Dr Hadley Wickham. The tidyverse tremendously improves the way we conduct data science - it allows for a very natural way of writing syntaxes and creating beautiful plots in R.
Our `AMR` package depends on these packages and even extends their use and functions.

View File

@ -23,7 +23,7 @@ knitr::opts_chunk$set(
```
## Needed R packages
As with many uses in R, we need some additional packages for AMR analysis. Our package works closely together with the [tidyverse packages](https://www.tidyverse.org) [`dplyr`](https://dplyr.tidyverse.org/) and [`ggplot2`](https://ggplot2.tidyverse.org) by [Dr Hadley Wickham](https://www.linkedin.com/in/hadleywickham/). The tidyverse tremendously improves the way we conduct data science - it allows for a very natural way of writing syntaxes and creating beautiful plots in R.
As with many uses in R, we need some additional packages for AMR analysis. Our package works closely together with the [tidyverse packages](https://www.tidyverse.org) [`dplyr`](https://dplyr.tidyverse.org/) and [`ggplot2`](https://ggplot2.tidyverse.org) by Dr Hadley Wickham. The tidyverse tremendously improves the way we conduct data science - it allows for a very natural way of writing syntaxes and creating beautiful plots in R.
Our `AMR` package depends on these packages and even extends their use and functions.