1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-26 04:06:12 +01:00

(v0.7.1.9074) CI updates

This commit is contained in:
dr. M.S. (Matthijs) Berends 2019-09-16 12:00:56 +02:00
parent 398c5bdc4f
commit f553a08a7b
19 changed files with 322 additions and 173 deletions

1
.gitignore vendored
View File

@ -20,7 +20,6 @@ vignettes/*.R
^CRAN-RELEASE$ ^CRAN-RELEASE$
packrat/lib*/ packrat/lib*/
packrat/src/ packrat/src/
cran-comments.md
data-raw/taxon.tab data-raw/taxon.tab
data-raw/DSMZ_bactnames.xlsx data-raw/DSMZ_bactnames.xlsx
R/aa_test.R R/aa_test.R

View File

@ -1,6 +1,6 @@
Package: AMR Package: AMR
Version: 0.7.1.9073 Version: 0.7.1.9074
Date: 2019-09-15 Date: 2019-09-16
Title: Antimicrobial Resistance Analysis Title: Antimicrobial Resistance Analysis
Authors@R: c( Authors@R: c(
person(role = c("aut", "cre"), person(role = c("aut", "cre"),
@ -59,4 +59,3 @@ License: GPL-2 | file LICENSE
Encoding: UTF-8 Encoding: UTF-8
LazyData: true LazyData: true
RoxygenNote: 6.1.1 RoxygenNote: 6.1.1
StagedInstall: false

View File

@ -316,3 +316,5 @@ importFrom(tidyr,spread)
importFrom(utils,browseURL) importFrom(utils,browseURL)
importFrom(utils,installed.packages) importFrom(utils,installed.packages)
importFrom(utils,menu) importFrom(utils,menu)
importFrom(utils,read.csv)
importFrom(utils,write.csv)

View File

@ -1,5 +1,5 @@
# AMR 0.7.1.9073 # AMR 0.7.1.9074
<small>Last updated: 15-Sep-2019</small> <small>Last updated: 16-Sep-2019</small>
### Breaking ### Breaking
* Determination of first isolates now **excludes** all 'unknown' microorganisms at default, i.e. microbial code `"UNKNOWN"`. They can be included with the new parameter `include_unknown`: * Determination of first isolates now **excludes** all 'unknown' microorganisms at default, i.e. microbial code `"UNKNOWN"`. They can be included with the new parameter `include_unknown`:

View File

@ -68,6 +68,7 @@ globalVariables(c(".",
"observed", "observed",
"old", "old",
"other_pat_or_mo", "other_pat_or_mo",
"package_version",
"patient_id", "patient_id",
"pattern", "pattern",
"plural", "plural",
@ -88,7 +89,9 @@ globalVariables(c(".",
"synonyms", "synonyms",
"total", "total",
"txt", "txt",
"uncertainty_level",
"value", "value",
"x",
"xdr", "xdr",
"y", "y",
"year")) "year"))

15
R/mo.R
View File

@ -258,7 +258,7 @@ as.mo <- function(x, Becker = FALSE, Lancefield = FALSE, allow_uncertain = TRUE,
y <- mo_validate(x = x, property = "mo", y <- mo_validate(x = x, property = "mo",
Becker = Becker, Lancefield = Lancefield, Becker = Becker, Lancefield = Lancefield,
allow_uncertain = uncertainty_level, reference_df = reference_df, allow_uncertain = uncertainty_level, reference_df = reference_df,
force_mo_history = isTRUE(list(...)$force_mo_history), #force_mo_history = isTRUE(list(...)$force_mo_history),
...) ...)
} }
@ -675,14 +675,16 @@ exec_as.mo <- function(x,
# translate known trivial abbreviations to genus + species ---- # translate known trivial abbreviations to genus + species ----
if (!is.na(x_trimmed[i])) { if (!is.na(x_trimmed[i])) {
if (toupper(x_backup_without_spp[i]) %in% c('MRSA', 'MSSA', 'VISA', 'VRSA')) { if (toupper(x_backup_without_spp[i]) %in% c('MRSA', 'MSSA', 'VISA', 'VRSA')
| x_backup_without_spp[i] %like_case% " (mrsa|mssa|visa|vrsa) ") {
x[i] <- microorganismsDT[mo == 'B_STPHY_AUR', ..property][[1]][1L] x[i] <- microorganismsDT[mo == 'B_STPHY_AUR', ..property][[1]][1L]
if (initial_search == TRUE) { if (initial_search == TRUE) {
set_mo_history(x_backup[i], get_mo_code(x[i], property), 0, force = force_mo_history, disable = disable_mo_history) set_mo_history(x_backup[i], get_mo_code(x[i], property), 0, force = force_mo_history, disable = disable_mo_history)
} }
next next
} }
if (toupper(x_backup_without_spp[i]) %in% c('MRSE', 'MSSE')) { if (toupper(x_backup_without_spp[i]) %in% c('MRSE', 'MSSE')
| x_backup_without_spp[i] %like_case% " (mrse|msse) ") {
x[i] <- microorganismsDT[mo == 'B_STPHY_EPI', ..property][[1]][1L] x[i] <- microorganismsDT[mo == 'B_STPHY_EPI', ..property][[1]][1L]
if (initial_search == TRUE) { if (initial_search == TRUE) {
set_mo_history(x_backup[i], get_mo_code(x[i], property), 0, force = force_mo_history, disable = disable_mo_history) set_mo_history(x_backup[i], get_mo_code(x[i], property), 0, force = force_mo_history, disable = disable_mo_history)
@ -690,6 +692,7 @@ exec_as.mo <- function(x,
next next
} }
if (toupper(x_backup_without_spp[i]) == "VRE" if (toupper(x_backup_without_spp[i]) == "VRE"
| x_backup_without_spp[i] %like_case% " vre "
| x_backup_without_spp[i] %like_case% '(enterococci|enterokok|enterococo)[a-z]*?$') { | x_backup_without_spp[i] %like_case% '(enterococci|enterokok|enterococo)[a-z]*?$') {
x[i] <- microorganismsDT[mo == 'B_ENTRC', ..property][[1]][1L] x[i] <- microorganismsDT[mo == 'B_ENTRC', ..property][[1]][1L]
if (initial_search == TRUE) { if (initial_search == TRUE) {
@ -718,7 +721,8 @@ exec_as.mo <- function(x,
} }
next next
} }
if (toupper(x_backup_without_spp[i]) == 'MRPA') { if (toupper(x_backup_without_spp[i]) == 'MRPA'
| x_backup_without_spp[i] %like_case% " mrpa ") {
# multi resistant P. aeruginosa # multi resistant P. aeruginosa
x[i] <- microorganismsDT[mo == 'B_PSDMN_AER', ..property][[1]][1L] x[i] <- microorganismsDT[mo == 'B_PSDMN_AER', ..property][[1]][1L]
if (initial_search == TRUE) { if (initial_search == TRUE) {
@ -735,7 +739,8 @@ exec_as.mo <- function(x,
} }
next next
} }
if (toupper(x_backup_without_spp[i]) %in% c('PISP', 'PRSP', 'VISP', 'VRSP')) { if (toupper(x_backup_without_spp[i]) %in% c('PISP', 'PRSP', 'VISP', 'VRSP')
| x_backup_without_spp[i] %like_case% " (pisp|prsp|visp|vrsp) ") {
# peni I, peni R, vanco I, vanco R: S. pneumoniae # peni I, peni R, vanco I, vanco R: S. pneumoniae
x[i] <- microorganismsDT[mo == 'B_STRPT_PNE', ..property][[1]][1L] x[i] <- microorganismsDT[mo == 'B_STRPT_PNE', ..property][[1]][1L]
if (initial_search == TRUE) { if (initial_search == TRUE) {

View File

@ -19,10 +19,9 @@
# Visit our website for more info: https://msberends.gitlab.io/AMR. # # Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== # # ==================================================================== #
mo_history_file <- file.path(file.path(system.file(package = "AMR"), "mo_history"), "mo_history.csv")
# print successful as.mo coercions to a options entry # print successful as.mo coercions to a options entry
#' @importFrom dplyr %>% distinct filter #' @importFrom dplyr %>% distinct filter
#' @importFrom utils write.csv
set_mo_history <- function(x, mo, uncertainty_level, force = FALSE, disable = FALSE) { set_mo_history <- function(x, mo, uncertainty_level, force = FALSE, disable = FALSE) {
if (isTRUE(disable)) { if (isTRUE(disable)) {
return(base::invisible()) return(base::invisible())
@ -42,14 +41,14 @@ set_mo_history <- function(x, mo, uncertainty_level, force = FALSE, disable = FA
# save package version too, as both the as.mo() algorithm and the reference data set may change # save package version too, as both the as.mo() algorithm and the reference data set may change
if (NROW(mo_hist[base::which(mo_hist$x == x[i] & if (NROW(mo_hist[base::which(mo_hist$x == x[i] &
mo_hist$uncertainty_level >= uncertainty_level & mo_hist$uncertainty_level >= uncertainty_level &
mo_hist$package_v == utils::packageVersion("AMR")),]) == 0) { mo_hist$package_version == utils::packageVersion("AMR")),]) == 0) {
# # Not using the file system: # # Not using the file system:
# tryCatch(options(mo_remembered_results = rbind(mo_hist, # tryCatch(options(mo_remembered_results = rbind(mo_hist,
# data.frame( # data.frame(
# x = x[i], # x = x[i],
# mo = mo[i], # mo = mo[i],
# uncertainty_level = uncertainty_level, # uncertainty_level = uncertainty_level,
# package_v = base::as.character(utils::packageVersion("AMR")), # package_version = base::as.character(utils::packageVersion("AMR")),
# stringsAsFactors = FALSE))), # stringsAsFactors = FALSE))),
# error = function(e) base::invisible()) # error = function(e) base::invisible())
# # don't remember more than 1,000 different input values # # don't remember more than 1,000 different input values
@ -57,16 +56,17 @@ set_mo_history <- function(x, mo, uncertainty_level, force = FALSE, disable = FA
# return(base::invisible()) # return(base::invisible())
# } # }
if (is.null(mo_hist)) { if (is.null(mo_hist)) {
message(blue(paste0("NOTE: results are saved to ", mo_history_file, "."))) message(blue(paste0("NOTE: results are saved to ", mo_history_file(), ".")))
} }
tryCatch(write.csv(rbind(mo_hist, tryCatch(write.csv(rbind(mo_hist,
data.frame( data.frame(
x = x[i], x = x[i],
mo = mo[i], mo = mo[i],
uncertainty_level = uncertainty_level, uncertainty_level = uncertainty_level,
package_v = base::as.character(utils::packageVersion("AMR")), package_version = base::as.character(utils::packageVersion("AMR")),
stringsAsFactors = FALSE)), stringsAsFactors = FALSE)),
file = mo_history_file, row.names = FALSE), row.names = FALSE,
file = mo_history_file()),
error = function(e) base::invisible()) error = function(e) base::invisible())
} }
} }
@ -91,6 +91,7 @@ get_mo_history <- function(x, uncertainty_level, force = FALSE, disable = FALSE)
} }
#' @importFrom dplyr %>% filter distinct #' @importFrom dplyr %>% filter distinct
#' @importFrom utils read.csv
read_mo_history <- function(uncertainty_level = 2, force = FALSE, unfiltered = FALSE, disable = FALSE) { read_mo_history <- function(uncertainty_level = 2, force = FALSE, unfiltered = FALSE, disable = FALSE) {
if (isTRUE(disable)) { if (isTRUE(disable)) {
return(NULL) return(NULL)
@ -104,7 +105,7 @@ read_mo_history <- function(uncertainty_level = 2, force = FALSE, unfiltered = F
# # Not using the file system: # # Not using the file system:
# history <- tryCatch(getOption("mo_remembered_results"), # history <- tryCatch(getOption("mo_remembered_results"),
# error = function(e) NULL) # error = function(e) NULL)
history <- tryCatch(read.csv(mo_history_file, stringsAsFactors = FALSE), history <- tryCatch(read.csv(mo_history_file(), stringsAsFactors = FALSE),
warning = function(w) invisible(), warning = function(w) invisible(),
error = function(e) NULL) error = function(e) NULL)
if (is.null(history)) { if (is.null(history)) {
@ -116,7 +117,7 @@ read_mo_history <- function(uncertainty_level = 2, force = FALSE, unfiltered = F
if (unfiltered == FALSE) { if (unfiltered == FALSE) {
history <- history %>% history <- history %>%
filter(package_v == as.character(utils::packageVersion("AMR")), filter(package_version == as.character(utils::packageVersion("AMR")),
# only take unknowns if uncertainty_level_param is higher # only take unknowns if uncertainty_level_param is higher
((mo == "UNKNOWN" & uncertainty_level_param == uncertainty_level) | ((mo == "UNKNOWN" & uncertainty_level_param == uncertainty_level) |
(mo != "UNKNOWN" & uncertainty_level_param >= uncertainty_level))) %>% (mo != "UNKNOWN" & uncertainty_level_param >= uncertainty_level))) %>%
@ -152,19 +153,54 @@ clear_mo_history <- function(...) {
# error = function(e) FALSE) # error = function(e) FALSE)
success <- create_blank_mo_history() success <- create_blank_mo_history()
if (!isFALSE(success)) { if (!isFALSE(success)) {
cat(red(paste("File", mo_history_file, "cleared."))) cat(red(paste("File", mo_history_file(), "cleared.")))
} }
} }
} }
#' @importFrom utils write.csv
create_blank_mo_history <- function() { create_blank_mo_history <- function() {
tryCatch( tryCatch(
write.csv(x = data.frame(x = character(0), write.csv(x = data.frame(x = character(0),
mo = character(0), mo = character(0),
uncertainty_level = integer(0), uncertainty_level = integer(0),
package_v = character(0), package_version = character(0),
stringsAsFactors = FALSE), stringsAsFactors = FALSE),
file = mo_history_file), row.names = FALSE,
file = mo_history_file()),
warning = function(w) invisible(), warning = function(w) invisible(),
error = function(e) TRUE) error = function(e) TRUE)
} }
# Borrowed all below code from the extrafont package,
# https://github.com/wch/extrafont/blob/254c3f99b02f11adb59affbda699a92aec8624f5/R/utils.r
inst_path <- function() {
envname <- environmentName(parent.env(environment()))
# If installed in package, envname == "AMR"
# If loaded with load_all, envname == "package:AMR"
# (This is kind of strange)
if (envname == "AMR") {
system.file(package = "AMR")
} else {
srcfile <- attr(attr(inst_path, "srcref"), "srcfile")
file.path(dirname(dirname(srcfile$filename)), "inst")
}
}
# Get the path where extrafontdb is installed
db_path <- function() {
system.file(package = "AMR")
}
# fonttable file
mo_history_file <- function() {
file.path(mo_history_path(), "mo_history.csv")
}
# Path of fontmap directory
mo_history_path <- function() {
file.path(db_path(), "mo_history")
}

4
cran-comments.md Normal file
View File

@ -0,0 +1,4 @@
# Version 0.8.0
* A NOTE for having a data directory over 3 MB. This is needed to offer users reference data for the complete taxonomy of microorganisms - one of the most important features of this pacakge. Has been this way since version 0.3.0.
* This package writes lines to `[user library]/AMR/inst/mo_history/mo_history.csv` when using the `as.mo()` function. Users are notified about this. The CSV file is never newly created or deleted by this package, it only changes this file to improve speed and reliability of the `as.mo()` function. Staged install still works. The source code was taken from the `extrafont` package on CRAN (version 0.17), that writes to the package folder in the user library exactly the same way. See the source code of `set_mo_history()` and `clear_mo_history()`.

View File

@ -78,7 +78,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <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.7.1.9073</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9074</span>
</span> </span>
</div> </div>

View File

@ -40,7 +40,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <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.7.1.9070</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9074</span>
</span> </span>
</div> </div>
@ -185,7 +185,7 @@
<h1>Benchmarks</h1> <h1>Benchmarks</h1>
<h4 class="author">Matthijs S. Berends</h4> <h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">02 September 2019</h4> <h4 class="date">16 September 2019</h4>
<div class="hidden name"><code>benchmarks.Rmd</code></div> <div class="hidden name"><code>benchmarks.Rmd</code></div>
@ -219,37 +219,37 @@
<a class="sourceLine" id="cb2-16" data-line-number="16"> <span class="dt">times =</span> <span class="dv">10</span>)</a> <a class="sourceLine" id="cb2-16" data-line-number="16"> <span class="dt">times =</span> <span class="dv">10</span>)</a>
<a class="sourceLine" id="cb2-17" data-line-number="17"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(S.aureus, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">2</span>)</a> <a class="sourceLine" id="cb2-17" data-line-number="17"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(S.aureus, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">2</span>)</a>
<a class="sourceLine" id="cb2-18" data-line-number="18"><span class="co"># Unit: milliseconds</span></a> <a class="sourceLine" id="cb2-18" data-line-number="18"><span class="co"># Unit: milliseconds</span></a>
<a class="sourceLine" id="cb2-19" data-line-number="19"><span class="co"># expr min lq mean median uq</span></a> <a class="sourceLine" id="cb2-19" data-line-number="19"><span class="co"># expr min lq mean median uq</span></a>
<a class="sourceLine" id="cb2-20" data-line-number="20"><span class="co"># as.mo("sau") 8.4 8.8 11.0 9.1 9.9</span></a> <a class="sourceLine" id="cb2-20" data-line-number="20"><span class="co"># as.mo("sau") 8.6 8.7 11.0 8.8 9.3</span></a>
<a class="sourceLine" id="cb2-21" data-line-number="21"><span class="co"># as.mo("stau") 32.0 33.0 37.0 34.0 35.0</span></a> <a class="sourceLine" id="cb2-21" data-line-number="21"><span class="co"># as.mo("stau") 30.0 30.0 41.0 31.0 32.0</span></a>
<a class="sourceLine" id="cb2-22" data-line-number="22"><span class="co"># as.mo("STAU") 32.0 33.0 40.0 34.0 52.0</span></a> <a class="sourceLine" id="cb2-22" data-line-number="22"><span class="co"># as.mo("STAU") 30.0 30.0 42.0 31.0 32.0</span></a>
<a class="sourceLine" id="cb2-23" data-line-number="23"><span class="co"># as.mo("staaur") 9.1 9.2 9.4 9.3 9.4</span></a> <a class="sourceLine" id="cb2-23" data-line-number="23"><span class="co"># as.mo("staaur") 8.5 8.9 12.0 9.1 9.6</span></a>
<a class="sourceLine" id="cb2-24" data-line-number="24"><span class="co"># as.mo("STAAUR") 8.6 9.1 11.0 9.3 9.7</span></a> <a class="sourceLine" id="cb2-24" data-line-number="24"><span class="co"># as.mo("STAAUR") 8.5 9.0 9.1 9.2 9.3</span></a>
<a class="sourceLine" id="cb2-25" data-line-number="25"><span class="co"># as.mo("S. aureus") 24.0 25.0 33.0 26.0 45.0</span></a> <a class="sourceLine" id="cb2-25" data-line-number="25"><span class="co"># as.mo("S. aureus") 23.0 23.0 30.0 23.0 40.0</span></a>
<a class="sourceLine" id="cb2-26" data-line-number="26"><span class="co"># as.mo("S aureus") 24.0 25.0 27.0 25.0 26.0</span></a> <a class="sourceLine" id="cb2-26" data-line-number="26"><span class="co"># as.mo("S aureus") 22.0 23.0 28.0 23.0 37.0</span></a>
<a class="sourceLine" id="cb2-27" data-line-number="27"><span class="co"># as.mo("Staphylococcus aureus") 4.0 4.1 4.5 4.3 4.6</span></a> <a class="sourceLine" id="cb2-27" data-line-number="27"><span class="co"># as.mo("Staphylococcus aureus") 28.0 29.0 30.0 30.0 31.0</span></a>
<a class="sourceLine" id="cb2-28" data-line-number="28"><span class="co"># as.mo("Staphylococcus aureus (MRSA)") 1500.0 1600.0 1700.0 1700.0 1700.0</span></a> <a class="sourceLine" id="cb2-28" data-line-number="28"><span class="co"># as.mo("Staphylococcus aureus (MRSA)") 520.0 530.0 540.0 540.0 550.0</span></a>
<a class="sourceLine" id="cb2-29" data-line-number="29"><span class="co"># as.mo("Sthafilokkockus aaureuz") 550.0 550.0 560.0 560.0 580.0</span></a> <a class="sourceLine" id="cb2-29" data-line-number="29"><span class="co"># as.mo("Sthafilokkockus aaureuz") 270.0 280.0 300.0 290.0 300.0</span></a>
<a class="sourceLine" id="cb2-30" data-line-number="30"><span class="co"># as.mo("MRSA") 8.7 9.0 9.4 9.2 10.0</span></a> <a class="sourceLine" id="cb2-30" data-line-number="30"><span class="co"># as.mo("MRSA") 8.5 8.7 8.9 8.8 9.0</span></a>
<a class="sourceLine" id="cb2-31" data-line-number="31"><span class="co"># as.mo("VISA") 19.0 20.0 26.0 21.0 37.0</span></a> <a class="sourceLine" id="cb2-31" data-line-number="31"><span class="co"># as.mo("VISA") 18.0 19.0 24.0 19.0 35.0</span></a>
<a class="sourceLine" id="cb2-32" data-line-number="32"><span class="co"># as.mo("VRSA") 19.0 19.0 20.0 20.0 20.0</span></a> <a class="sourceLine" id="cb2-32" data-line-number="32"><span class="co"># as.mo("VRSA") 18.0 18.0 31.0 19.0 34.0</span></a>
<a class="sourceLine" id="cb2-33" data-line-number="33"><span class="co"># as.mo(22242419) 18.0 18.0 24.0 20.0 21.0</span></a> <a class="sourceLine" id="cb2-33" data-line-number="33"><span class="co"># as.mo(22242419) 17.0 18.0 22.0 18.0 19.0</span></a>
<a class="sourceLine" id="cb2-34" data-line-number="34"><span class="co"># max neval</span></a> <a class="sourceLine" id="cb2-34" data-line-number="34"><span class="co"># max neval</span></a>
<a class="sourceLine" id="cb2-35" data-line-number="35"><span class="co"># 27.0 10</span></a> <a class="sourceLine" id="cb2-35" data-line-number="35"><span class="co"># 28.0 10</span></a>
<a class="sourceLine" id="cb2-36" data-line-number="36"><span class="co"># 61.0 10</span></a> <a class="sourceLine" id="cb2-36" data-line-number="36"><span class="co"># 120.0 10</span></a>
<a class="sourceLine" id="cb2-37" data-line-number="37"><span class="co"># 58.0 10</span></a> <a class="sourceLine" id="cb2-37" data-line-number="37"><span class="co"># 120.0 10</span></a>
<a class="sourceLine" id="cb2-38" data-line-number="38"><span class="co"># 10.0 10</span></a> <a class="sourceLine" id="cb2-38" data-line-number="38"><span class="co"># 34.0 10</span></a>
<a class="sourceLine" id="cb2-39" data-line-number="39"><span class="co"># 26.0 10</span></a> <a class="sourceLine" id="cb2-39" data-line-number="39"><span class="co"># 9.4 10</span></a>
<a class="sourceLine" id="cb2-40" data-line-number="40"><span class="co"># 48.0 10</span></a> <a class="sourceLine" id="cb2-40" data-line-number="40"><span class="co"># 41.0 10</span></a>
<a class="sourceLine" id="cb2-41" data-line-number="41"><span class="co"># 42.0 10</span></a> <a class="sourceLine" id="cb2-41" data-line-number="41"><span class="co"># 43.0 10</span></a>
<a class="sourceLine" id="cb2-42" data-line-number="42"><span class="co"># 5.9 10</span></a> <a class="sourceLine" id="cb2-42" data-line-number="42"><span class="co"># 31.0 10</span></a>
<a class="sourceLine" id="cb2-43" data-line-number="43"><span class="co"># 1700.0 10</span></a> <a class="sourceLine" id="cb2-43" data-line-number="43"><span class="co"># 570.0 10</span></a>
<a class="sourceLine" id="cb2-44" data-line-number="44"><span class="co"># 590.0 10</span></a> <a class="sourceLine" id="cb2-44" data-line-number="44"><span class="co"># 400.0 10</span></a>
<a class="sourceLine" id="cb2-45" data-line-number="45"><span class="co"># 10.0 10</span></a> <a class="sourceLine" id="cb2-45" data-line-number="45"><span class="co"># 9.3 10</span></a>
<a class="sourceLine" id="cb2-46" data-line-number="46"><span class="co"># 41.0 10</span></a> <a class="sourceLine" id="cb2-46" data-line-number="46"><span class="co"># 36.0 10</span></a>
<a class="sourceLine" id="cb2-47" data-line-number="47"><span class="co"># 21.0 10</span></a> <a class="sourceLine" id="cb2-47" data-line-number="47"><span class="co"># 110.0 10</span></a>
<a class="sourceLine" id="cb2-48" data-line-number="48"><span class="co"># 45.0 10</span></a></code></pre></div> <a class="sourceLine" id="cb2-48" data-line-number="48"><span class="co"># 43.0 10</span></a></code></pre></div>
<p><img src="benchmarks_files/figure-html/unnamed-chunk-4-1.png" width="1125"></p> <p><img src="benchmarks_files/figure-html/unnamed-chunk-4-1.png" width="562.5"></p>
<p>In the table above, all measurements are shown in milliseconds (thousands of seconds). A value of 5 milliseconds means it can determine 200 input values per second. It case of 100 milliseconds, this is only 10 input values per second. The second input is the only one that has to be looked up thoroughly. All the others are known codes (the first one is a WHONET code) or common laboratory codes, or common full organism names like the last one. Full organism names are always preferred.</p> <p>In the table above, all measurements are shown in milliseconds (thousands of seconds). A value of 5 milliseconds means it can determine 200 input values per second. It case of 100 milliseconds, this is only 10 input values per second. The second input is the only one that has to be looked up thoroughly. All the others are known codes (the first one is a WHONET code) or common laboratory codes, or common full organism names like the last one. Full organism names are always preferred.</p>
<p>To achieve this speed, the <code>as.mo</code> function also takes into account the prevalence of human pathogenic microorganisms. The downside is of course that less prevalent microorganisms will be determined less fast. See this example for the ID of <em>Thermus islandicus</em> (<code>B_THERMS_ISL</code>), a bug probably never found before in humans:</p> <p>To achieve this speed, the <code>as.mo</code> function also takes into account the prevalence of human pathogenic microorganisms. The downside is of course that less prevalent microorganisms will be determined less fast. See this example for the ID of <em>Thermus islandicus</em> (<code>B_THERMS_ISL</code>), a bug probably never found before in humans:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" data-line-number="1">T.islandicus &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"theisl"</span>),</a> <div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" data-line-number="1">T.islandicus &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"theisl"</span>),</a>
@ -258,119 +258,219 @@
<a class="sourceLine" id="cb3-4" data-line-number="4"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"T. islandicus"</span>),</a> <a class="sourceLine" id="cb3-4" data-line-number="4"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"T. islandicus"</span>),</a>
<a class="sourceLine" id="cb3-5" data-line-number="5"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"Thermus islandicus"</span>),</a> <a class="sourceLine" id="cb3-5" data-line-number="5"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"Thermus islandicus"</span>),</a>
<a class="sourceLine" id="cb3-6" data-line-number="6"> <span class="dt">times =</span> <span class="dv">10</span>)</a> <a class="sourceLine" id="cb3-6" data-line-number="6"> <span class="dt">times =</span> <span class="dv">10</span>)</a>
<a class="sourceLine" id="cb3-7" data-line-number="7"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(T.islandicus, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">2</span>)</a> <a class="sourceLine" id="cb3-7" data-line-number="7"><span class="co"># Warning: </span></a>
<a class="sourceLine" id="cb3-8" data-line-number="8"><span class="co"># Unit: milliseconds</span></a> <a class="sourceLine" id="cb3-8" data-line-number="8"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
<a class="sourceLine" id="cb3-9" data-line-number="9"><span class="co"># expr min lq mean median uq max neval</span></a> <a class="sourceLine" id="cb3-9" data-line-number="9"></a>
<a class="sourceLine" id="cb3-10" data-line-number="10"><span class="co"># as.mo("theisl") 300 300 320 320 330 340 10</span></a> <a class="sourceLine" id="cb3-10" data-line-number="10"><span class="co"># Warning: </span></a>
<a class="sourceLine" id="cb3-11" data-line-number="11"><span class="co"># as.mo("THEISL") 290 320 330 320 330 400 10</span></a> <a class="sourceLine" id="cb3-11" data-line-number="11"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
<a class="sourceLine" id="cb3-12" data-line-number="12"><span class="co"># as.mo("T. islandicus") 150 150 160 170 170 170 10</span></a> <a class="sourceLine" id="cb3-12" data-line-number="12"></a>
<a class="sourceLine" id="cb3-13" data-line-number="13"><span class="co"># as.mo("T. islandicus") 140 150 150 150 160 170 10</span></a> <a class="sourceLine" id="cb3-13" data-line-number="13"><span class="co"># Warning: </span></a>
<a class="sourceLine" id="cb3-14" data-line-number="14"><span class="co"># as.mo("Thermus islandicus") 53 55 65 59 76 80 10</span></a></code></pre></div> <a class="sourceLine" id="cb3-14" data-line-number="14"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
<p>That takes 1.2 times as much time on average. A value of 100 milliseconds means it can only determine ~10 different input values per second. We can conclude that looking up arbitrary codes of less prevalent microorganisms is the worst way to go, in terms of calculation performance. Full names (like <em>Thermus islandicus</em>) are almost fast - these are the most probable input from most data sets.</p> <a class="sourceLine" id="cb3-15" data-line-number="15"></a>
<a class="sourceLine" id="cb3-16" data-line-number="16"><span class="co"># Warning: </span></a>
<a class="sourceLine" id="cb3-17" data-line-number="17"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
<a class="sourceLine" id="cb3-18" data-line-number="18"></a>
<a class="sourceLine" id="cb3-19" data-line-number="19"><span class="co"># Warning: </span></a>
<a class="sourceLine" id="cb3-20" data-line-number="20"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
<a class="sourceLine" id="cb3-21" data-line-number="21"></a>
<a class="sourceLine" id="cb3-22" data-line-number="22"><span class="co"># Warning: </span></a>
<a class="sourceLine" id="cb3-23" data-line-number="23"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
<a class="sourceLine" id="cb3-24" data-line-number="24"></a>
<a class="sourceLine" id="cb3-25" data-line-number="25"><span class="co"># Warning: </span></a>
<a class="sourceLine" id="cb3-26" data-line-number="26"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
<a class="sourceLine" id="cb3-27" data-line-number="27"></a>
<a class="sourceLine" id="cb3-28" data-line-number="28"><span class="co"># Warning: </span></a>
<a class="sourceLine" id="cb3-29" data-line-number="29"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
<a class="sourceLine" id="cb3-30" data-line-number="30"></a>
<a class="sourceLine" id="cb3-31" data-line-number="31"><span class="co"># Warning: </span></a>
<a class="sourceLine" id="cb3-32" data-line-number="32"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
<a class="sourceLine" id="cb3-33" data-line-number="33"></a>
<a class="sourceLine" id="cb3-34" data-line-number="34"><span class="co"># Warning: </span></a>
<a class="sourceLine" id="cb3-35" data-line-number="35"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
<a class="sourceLine" id="cb3-36" data-line-number="36"></a>
<a class="sourceLine" id="cb3-37" data-line-number="37"><span class="co"># Warning: </span></a>
<a class="sourceLine" id="cb3-38" data-line-number="38"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
<a class="sourceLine" id="cb3-39" data-line-number="39"></a>
<a class="sourceLine" id="cb3-40" data-line-number="40"><span class="co"># Warning: </span></a>
<a class="sourceLine" id="cb3-41" data-line-number="41"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
<a class="sourceLine" id="cb3-42" data-line-number="42"></a>
<a class="sourceLine" id="cb3-43" data-line-number="43"><span class="co"># Warning: </span></a>
<a class="sourceLine" id="cb3-44" data-line-number="44"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
<a class="sourceLine" id="cb3-45" data-line-number="45"></a>
<a class="sourceLine" id="cb3-46" data-line-number="46"><span class="co"># Warning: </span></a>
<a class="sourceLine" id="cb3-47" data-line-number="47"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
<a class="sourceLine" id="cb3-48" data-line-number="48"></a>
<a class="sourceLine" id="cb3-49" data-line-number="49"><span class="co"># Warning: </span></a>
<a class="sourceLine" id="cb3-50" data-line-number="50"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
<a class="sourceLine" id="cb3-51" data-line-number="51"></a>
<a class="sourceLine" id="cb3-52" data-line-number="52"><span class="co"># Warning: </span></a>
<a class="sourceLine" id="cb3-53" data-line-number="53"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
<a class="sourceLine" id="cb3-54" data-line-number="54"></a>
<a class="sourceLine" id="cb3-55" data-line-number="55"><span class="co"># Warning: </span></a>
<a class="sourceLine" id="cb3-56" data-line-number="56"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
<a class="sourceLine" id="cb3-57" data-line-number="57"></a>
<a class="sourceLine" id="cb3-58" data-line-number="58"><span class="co"># Warning: </span></a>
<a class="sourceLine" id="cb3-59" data-line-number="59"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
<a class="sourceLine" id="cb3-60" data-line-number="60"></a>
<a class="sourceLine" id="cb3-61" data-line-number="61"><span class="co"># Warning: </span></a>
<a class="sourceLine" id="cb3-62" data-line-number="62"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
<a class="sourceLine" id="cb3-63" data-line-number="63"></a>
<a class="sourceLine" id="cb3-64" data-line-number="64"><span class="co"># Warning: </span></a>
<a class="sourceLine" id="cb3-65" data-line-number="65"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
<a class="sourceLine" id="cb3-66" data-line-number="66"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(T.islandicus, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">2</span>)</a>
<a class="sourceLine" id="cb3-67" data-line-number="67"><span class="co"># Unit: milliseconds</span></a>
<a class="sourceLine" id="cb3-68" data-line-number="68"><span class="co"># expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb3-69" data-line-number="69"><span class="co"># as.mo("theisl") 1300 1300 1300 1300 1400 1400 10</span></a>
<a class="sourceLine" id="cb3-70" data-line-number="70"><span class="co"># as.mo("THEISL") 1300 1300 1300 1300 1300 1400 10</span></a>
<a class="sourceLine" id="cb3-71" data-line-number="71"><span class="co"># as.mo("T. islandicus") 360 360 370 380 380 390 10</span></a>
<a class="sourceLine" id="cb3-72" data-line-number="72"><span class="co"># as.mo("T. islandicus") 360 370 400 380 450 480 10</span></a>
<a class="sourceLine" id="cb3-73" data-line-number="73"><span class="co"># as.mo("Thermus islandicus") 29 30 32 30 30 50 10</span></a></code></pre></div>
<p>That takes 8.6 times as much time on average. A value of 100 milliseconds means it can only determine ~10 different input values per second. We can conclude that looking up arbitrary codes of less prevalent microorganisms is the worst way to go, in terms of calculation performance. Full names (like <em>Thermus islandicus</em>) are almost fast - these are the most probable input from most data sets.</p>
<p>In the figure below, we compare <em>Escherichia coli</em> (which is very common) with <em>Prevotella brevis</em> (which is moderately common) and with <em>Thermus islandicus</em> (which is uncommon):</p> <p>In the figure below, we compare <em>Escherichia coli</em> (which is very common) with <em>Prevotella brevis</em> (which is moderately common) and with <em>Thermus islandicus</em> (which is uncommon):</p>
<p><img src="benchmarks_files/figure-html/unnamed-chunk-6-1.png" width="1125"><img src="benchmarks_files/figure-html/unnamed-chunk-6-2.png" width="1125"><img src="benchmarks_files/figure-html/unnamed-chunk-6-3.png" width="1125"></p> <pre><code># Warning:
# Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.
# NOTE: Prevotella ruminicola brevis was renamed Prevotella brevis (Avgustin et al., 1997) (B_PRVTL_BRE)
# Warning:
# Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.
# NOTE: Prevotella ruminicola brevis was renamed Prevotella brevis (Avgustin et al., 1997) (B_PRVTL_BRE)
# NOTE: Prevotella ruminicola brevis was renamed Prevotella brevis (Avgustin et al., 1997) (B_PRVTL_BRE)
# Warning:
# Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.
# Warning:
# Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.
# NOTE: Prevotella ruminicola brevis was renamed Prevotella brevis (Avgustin et al., 1997) (B_PRVTL_BRE)
# NOTE: Prevotella ruminicola brevis was renamed Prevotella brevis (Avgustin et al., 1997) (B_PRVTL_BRE)
# Warning:
# Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.
# Warning:
# Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.
# NOTE: Prevotella ruminicola brevis was renamed Prevotella brevis (Avgustin et al., 1997) (B_PRVTL_BRE)
# NOTE: Prevotella ruminicola brevis was renamed Prevotella brevis (Avgustin et al., 1997) (B_PRVTL_BRE)
# NOTE: Prevotella ruminicola brevis was renamed Prevotella brevis (Avgustin et al., 1997) (B_PRVTL_BRE)
# Warning:
# Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.
# Warning:
# Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.
# NOTE: Prevotella ruminicola brevis was renamed Prevotella brevis (Avgustin et al., 1997) (B_PRVTL_BRE)
# Warning:
# Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.
# Warning:
# Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.
# NOTE: Prevotella ruminicola brevis was renamed Prevotella brevis (Avgustin et al., 1997) (B_PRVTL_BRE)</code></pre>
<p><img src="benchmarks_files/figure-html/unnamed-chunk-6-1.png" width="562.5"></p>
<p>In reality, the <code><a href="../reference/as.mo.html">as.mo()</a></code> functions <strong>learns from its own output to speed up determinations for next times</strong>. In above figure, this effect was disabled to show the difference with the boxplot below - when you would use <code><a href="../reference/as.mo.html">as.mo()</a></code> yourself:</p>
<pre><code># NOTE: results are saved to /Users/msberends/Library/R/3.6/library/AMR/mo_history/mo_history.csv.
# Warning:
# Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.
# NOTE: Prevotella ruminicola brevis was renamed Prevotella brevis (Avgustin et al., 1997) (B_PRVTL_BRE)</code></pre>
<p><img src="benchmarks_files/figure-html/unnamed-chunk-7-1.png" width="562.5"></p>
<p>The highest outliers are the first times. All next determinations were done in only thousands of seconds.</p>
<p>Uncommon microorganisms take a lot more time than common microorganisms. To relieve this pitfall and further improve performance, two important calculations take almost no time at all: <strong>repetitive results</strong> and <strong>already precalculated results</strong>.</p> <p>Uncommon microorganisms take a lot more time than common microorganisms. To relieve this pitfall and further improve performance, two important calculations take almost no time at all: <strong>repetitive results</strong> and <strong>already precalculated results</strong>.</p>
<div id="repetitive-results" class="section level3"> <div id="repetitive-results" class="section level3">
<h3 class="hasAnchor"> <h3 class="hasAnchor">
<a href="#repetitive-results" class="anchor"></a>Repetitive results</h3> <a href="#repetitive-results" class="anchor"></a>Repetitive results</h3>
<p>Repetitive results are unique values that are present more than once. Unique values will only be calculated once by <code><a href="../reference/as.mo.html">as.mo()</a></code>. We will use <code><a href="../reference/mo_property.html">mo_name()</a></code> for this test - a helper function that returns the full microbial name (genus, species and possibly subspecies) which uses <code><a href="../reference/as.mo.html">as.mo()</a></code> internally.</p> <p>Repetitive results are unique values that are present more than once. Unique values will only be calculated once by <code><a href="../reference/as.mo.html">as.mo()</a></code>. We will use <code><a href="../reference/mo_property.html">mo_name()</a></code> for this test - a helper function that returns the full microbial name (genus, species and possibly subspecies) which uses <code><a href="../reference/as.mo.html">as.mo()</a></code> internally.</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(dplyr)</a> <div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(dplyr)</a>
<a class="sourceLine" id="cb4-2" data-line-number="2"><span class="co"># take all MO codes from the example_isolates data set</span></a> <a class="sourceLine" id="cb6-2" data-line-number="2"><span class="co"># take all MO codes from the example_isolates data set</span></a>
<a class="sourceLine" id="cb4-3" data-line-number="3">x &lt;-<span class="st"> </span>example_isolates<span class="op">$</span>mo <span class="op">%&gt;%</span></a> <a class="sourceLine" id="cb6-3" data-line-number="3">x &lt;-<span class="st"> </span>example_isolates<span class="op">$</span>mo <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb4-4" data-line-number="4"><span class="st"> </span><span class="co"># keep only the unique ones</span></a> <a class="sourceLine" id="cb6-4" data-line-number="4"><span class="st"> </span><span class="co"># keep only the unique ones</span></a>
<a class="sourceLine" id="cb4-5" data-line-number="5"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/unique">unique</a></span>() <span class="op">%&gt;%</span></a> <a class="sourceLine" id="cb6-5" data-line-number="5"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/unique">unique</a></span>() <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb4-6" data-line-number="6"><span class="st"> </span><span class="co"># pick 50 of them at random</span></a> <a class="sourceLine" id="cb6-6" data-line-number="6"><span class="st"> </span><span class="co"># pick 50 of them at random</span></a>
<a class="sourceLine" id="cb4-7" data-line-number="7"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/sample.html">sample</a></span>(<span class="dv">50</span>) <span class="op">%&gt;%</span></a> <a class="sourceLine" id="cb6-7" data-line-number="7"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/sample.html">sample</a></span>(<span class="dv">50</span>) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb4-8" data-line-number="8"><span class="st"> </span><span class="co"># paste that 10,000 times</span></a> <a class="sourceLine" id="cb6-8" data-line-number="8"><span class="st"> </span><span class="co"># paste that 10,000 times</span></a>
<a class="sourceLine" id="cb4-9" data-line-number="9"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/rep">rep</a></span>(<span class="dv">10000</span>) <span class="op">%&gt;%</span></a> <a class="sourceLine" id="cb6-9" data-line-number="9"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/rep">rep</a></span>(<span class="dv">10000</span>) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb4-10" data-line-number="10"><span class="st"> </span><span class="co"># scramble it</span></a> <a class="sourceLine" id="cb6-10" data-line-number="10"><span class="st"> </span><span class="co"># scramble it</span></a>
<a class="sourceLine" id="cb4-11" data-line-number="11"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/sample.html">sample</a></span>()</a> <a class="sourceLine" id="cb6-11" data-line-number="11"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/sample.html">sample</a></span>()</a>
<a class="sourceLine" id="cb4-12" data-line-number="12"> </a> <a class="sourceLine" id="cb6-12" data-line-number="12"> </a>
<a class="sourceLine" id="cb4-13" data-line-number="13"><span class="co"># got indeed 50 times 10,000 = half a million?</span></a> <a class="sourceLine" id="cb6-13" data-line-number="13"><span class="co"># got indeed 50 times 10,000 = half a million?</span></a>
<a class="sourceLine" id="cb4-14" data-line-number="14"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/length">length</a></span>(x)</a> <a class="sourceLine" id="cb6-14" data-line-number="14"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/length">length</a></span>(x)</a>
<a class="sourceLine" id="cb4-15" data-line-number="15"><span class="co"># [1] 500000</span></a> <a class="sourceLine" id="cb6-15" data-line-number="15"><span class="co"># [1] 500000</span></a>
<a class="sourceLine" id="cb4-16" data-line-number="16"></a> <a class="sourceLine" id="cb6-16" data-line-number="16"></a>
<a class="sourceLine" id="cb4-17" data-line-number="17"><span class="co"># and how many unique values do we have?</span></a> <a class="sourceLine" id="cb6-17" data-line-number="17"><span class="co"># and how many unique values do we have?</span></a>
<a class="sourceLine" id="cb4-18" data-line-number="18"><span class="kw"><a href="https://dplyr.tidyverse.org/reference/n_distinct.html">n_distinct</a></span>(x)</a> <a class="sourceLine" id="cb6-18" data-line-number="18"><span class="kw"><a href="https://dplyr.tidyverse.org/reference/n_distinct.html">n_distinct</a></span>(x)</a>
<a class="sourceLine" id="cb4-19" data-line-number="19"><span class="co"># [1] 50</span></a> <a class="sourceLine" id="cb6-19" data-line-number="19"><span class="co"># [1] 50</span></a>
<a class="sourceLine" id="cb4-20" data-line-number="20"></a> <a class="sourceLine" id="cb6-20" data-line-number="20"></a>
<a class="sourceLine" id="cb4-21" data-line-number="21"><span class="co"># now let's see:</span></a> <a class="sourceLine" id="cb6-21" data-line-number="21"><span class="co"># now let's see:</span></a>
<a class="sourceLine" id="cb4-22" data-line-number="22">run_it &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(x),</a> <a class="sourceLine" id="cb6-22" data-line-number="22">run_it &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(x),</a>
<a class="sourceLine" id="cb4-23" data-line-number="23"> <span class="dt">times =</span> <span class="dv">10</span>)</a> <a class="sourceLine" id="cb6-23" data-line-number="23"> <span class="dt">times =</span> <span class="dv">10</span>)</a>
<a class="sourceLine" id="cb4-24" data-line-number="24"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">3</span>)</a> <a class="sourceLine" id="cb6-24" data-line-number="24"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">3</span>)</a>
<a class="sourceLine" id="cb4-25" data-line-number="25"><span class="co"># Unit: milliseconds</span></a> <a class="sourceLine" id="cb6-25" data-line-number="25"><span class="co"># Unit: milliseconds</span></a>
<a class="sourceLine" id="cb4-26" data-line-number="26"><span class="co"># expr min lq mean median uq max neval</span></a> <a class="sourceLine" id="cb6-26" data-line-number="26"><span class="co"># expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb4-27" data-line-number="27"><span class="co"># mo_name(x) 625 659 686 689 698 746 10</span></a></code></pre></div> <a class="sourceLine" id="cb6-27" data-line-number="27"><span class="co"># mo_name(x) 607 619 636 632 660 671 10</span></a></code></pre></div>
<p>So transforming 500,000 values (!!) of 50 unique values only takes 0.69 seconds (688 ms). You only lose time on your unique input values.</p> <p>So transforming 500,000 values (!!) of 50 unique values only takes 0.63 seconds (632 ms). You only lose time on your unique input values.</p>
</div> </div>
<div id="precalculated-results" class="section level3"> <div id="precalculated-results" class="section level3">
<h3 class="hasAnchor"> <h3 class="hasAnchor">
<a href="#precalculated-results" class="anchor"></a>Precalculated results</h3> <a href="#precalculated-results" class="anchor"></a>Precalculated results</h3>
<p>What about precalculated results? If the input is an already precalculated result of a helper function like <code><a href="../reference/mo_property.html">mo_name()</a></code>, it almost doesnt take any time at all (see C below):</p> <p>What about precalculated results? If the input is an already precalculated result of a helper function like <code><a href="../reference/mo_property.html">mo_name()</a></code>, it almost doesnt take any time at all (see C below):</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" data-line-number="1">run_it &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="dt">A =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"B_STPHY_AUR"</span>),</a> <div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" data-line-number="1">run_it &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="dt">A =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"B_STPHY_AUR"</span>),</a>
<a class="sourceLine" id="cb5-2" data-line-number="2"> <span class="dt">B =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"S. aureus"</span>),</a> <a class="sourceLine" id="cb7-2" data-line-number="2"> <span class="dt">B =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"S. aureus"</span>),</a>
<a class="sourceLine" id="cb5-3" data-line-number="3"> <span class="dt">C =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"Staphylococcus aureus"</span>),</a> <a class="sourceLine" id="cb7-3" data-line-number="3"> <span class="dt">C =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"Staphylococcus aureus"</span>),</a>
<a class="sourceLine" id="cb5-4" data-line-number="4"> <span class="dt">times =</span> <span class="dv">10</span>)</a> <a class="sourceLine" id="cb7-4" data-line-number="4"> <span class="dt">times =</span> <span class="dv">10</span>)</a>
<a class="sourceLine" id="cb5-5" data-line-number="5"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">3</span>)</a> <a class="sourceLine" id="cb7-5" data-line-number="5"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">3</span>)</a>
<a class="sourceLine" id="cb5-6" data-line-number="6"><span class="co"># Unit: milliseconds</span></a> <a class="sourceLine" id="cb7-6" data-line-number="6"><span class="co"># Unit: milliseconds</span></a>
<a class="sourceLine" id="cb5-7" data-line-number="7"><span class="co"># expr min lq mean median uq max neval</span></a> <a class="sourceLine" id="cb7-7" data-line-number="7"><span class="co"># expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb5-8" data-line-number="8"><span class="co"># A 6.930 7.380 7.87 7.580 8.20 9.54 10</span></a> <a class="sourceLine" id="cb7-8" data-line-number="8"><span class="co"># A 6.410 6.500 6.720 6.570 6.840 7.660 10</span></a>
<a class="sourceLine" id="cb5-9" data-line-number="9"><span class="co"># B 23.700 25.700 30.50 26.000 29.60 59.00 10</span></a> <a class="sourceLine" id="cb7-9" data-line-number="9"><span class="co"># B 21.700 22.100 25.900 22.600 24.200 48.600 10</span></a>
<a class="sourceLine" id="cb5-10" data-line-number="10"><span class="co"># C 0.859 0.912 0.99 0.958 1.05 1.24 10</span></a></code></pre></div> <a class="sourceLine" id="cb7-10" data-line-number="10"><span class="co"># C 0.763 0.774 0.812 0.812 0.849 0.855 10</span></a></code></pre></div>
<p>So going from <code><a href="../reference/mo_property.html">mo_name("Staphylococcus aureus")</a></code> to <code>"Staphylococcus aureus"</code> takes 0.001 seconds - it doesnt even start calculating <em>if the result would be the same as the expected resulting value</em>. That goes for all helper functions:</p> <p>So going from <code><a href="../reference/mo_property.html">mo_name("Staphylococcus aureus")</a></code> to <code>"Staphylococcus aureus"</code> takes 0.0008 seconds - it doesnt even start calculating <em>if the result would be the same as the expected resulting value</em>. That goes for all helper functions:</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" data-line-number="1">run_it &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="dt">A =</span> <span class="kw"><a href="../reference/mo_property.html">mo_species</a></span>(<span class="st">"aureus"</span>),</a> <div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" data-line-number="1">run_it &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="dt">A =</span> <span class="kw"><a href="../reference/mo_property.html">mo_species</a></span>(<span class="st">"aureus"</span>),</a>
<a class="sourceLine" id="cb6-2" data-line-number="2"> <span class="dt">B =</span> <span class="kw"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="st">"Staphylococcus"</span>),</a> <a class="sourceLine" id="cb8-2" data-line-number="2"> <span class="dt">B =</span> <span class="kw"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="st">"Staphylococcus"</span>),</a>
<a class="sourceLine" id="cb6-3" data-line-number="3"> <span class="dt">C =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"Staphylococcus aureus"</span>),</a> <a class="sourceLine" id="cb8-3" data-line-number="3"> <span class="dt">C =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"Staphylococcus aureus"</span>),</a>
<a class="sourceLine" id="cb6-4" data-line-number="4"> <span class="dt">D =</span> <span class="kw"><a href="../reference/mo_property.html">mo_family</a></span>(<span class="st">"Staphylococcaceae"</span>),</a> <a class="sourceLine" id="cb8-4" data-line-number="4"> <span class="dt">D =</span> <span class="kw"><a href="../reference/mo_property.html">mo_family</a></span>(<span class="st">"Staphylococcaceae"</span>),</a>
<a class="sourceLine" id="cb6-5" data-line-number="5"> <span class="dt">E =</span> <span class="kw"><a href="../reference/mo_property.html">mo_order</a></span>(<span class="st">"Bacillales"</span>),</a> <a class="sourceLine" id="cb8-5" data-line-number="5"> <span class="dt">E =</span> <span class="kw"><a href="../reference/mo_property.html">mo_order</a></span>(<span class="st">"Bacillales"</span>),</a>
<a class="sourceLine" id="cb6-6" data-line-number="6"> <span class="dt">F =</span> <span class="kw"><a href="../reference/mo_property.html">mo_class</a></span>(<span class="st">"Bacilli"</span>),</a> <a class="sourceLine" id="cb8-6" data-line-number="6"> <span class="dt">F =</span> <span class="kw"><a href="../reference/mo_property.html">mo_class</a></span>(<span class="st">"Bacilli"</span>),</a>
<a class="sourceLine" id="cb6-7" data-line-number="7"> <span class="dt">G =</span> <span class="kw"><a href="../reference/mo_property.html">mo_phylum</a></span>(<span class="st">"Firmicutes"</span>),</a> <a class="sourceLine" id="cb8-7" data-line-number="7"> <span class="dt">G =</span> <span class="kw"><a href="../reference/mo_property.html">mo_phylum</a></span>(<span class="st">"Firmicutes"</span>),</a>
<a class="sourceLine" id="cb6-8" data-line-number="8"> <span class="dt">H =</span> <span class="kw"><a href="../reference/mo_property.html">mo_kingdom</a></span>(<span class="st">"Bacteria"</span>),</a> <a class="sourceLine" id="cb8-8" data-line-number="8"> <span class="dt">H =</span> <span class="kw"><a href="../reference/mo_property.html">mo_kingdom</a></span>(<span class="st">"Bacteria"</span>),</a>
<a class="sourceLine" id="cb6-9" data-line-number="9"> <span class="dt">times =</span> <span class="dv">10</span>)</a> <a class="sourceLine" id="cb8-9" data-line-number="9"> <span class="dt">times =</span> <span class="dv">10</span>)</a>
<a class="sourceLine" id="cb6-10" data-line-number="10"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">3</span>)</a> <a class="sourceLine" id="cb8-10" data-line-number="10"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">3</span>)</a>
<a class="sourceLine" id="cb6-11" data-line-number="11"><span class="co"># Unit: milliseconds</span></a> <a class="sourceLine" id="cb8-11" data-line-number="11"><span class="co"># Unit: milliseconds</span></a>
<a class="sourceLine" id="cb6-12" data-line-number="12"><span class="co"># expr min lq mean median uq max neval</span></a> <a class="sourceLine" id="cb8-12" data-line-number="12"><span class="co"># expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb6-13" data-line-number="13"><span class="co"># A 0.478 0.490 0.512 0.509 0.530 0.579 10</span></a> <a class="sourceLine" id="cb8-13" data-line-number="13"><span class="co"># A 0.449 0.471 0.492 0.474 0.483 0.671 10</span></a>
<a class="sourceLine" id="cb6-14" data-line-number="14"><span class="co"># B 0.644 0.670 0.711 0.673 0.740 0.930 10</span></a> <a class="sourceLine" id="cb8-14" data-line-number="14"><span class="co"># B 0.611 0.621 0.638 0.626 0.629 0.717 10</span></a>
<a class="sourceLine" id="cb6-15" data-line-number="15"><span class="co"># C 0.697 0.815 0.887 0.840 0.992 1.150 10</span></a> <a class="sourceLine" id="cb8-15" data-line-number="15"><span class="co"># C 0.649 0.706 0.743 0.743 0.807 0.818 10</span></a>
<a class="sourceLine" id="cb6-16" data-line-number="16"><span class="co"># D 0.456 0.486 0.511 0.503 0.521 0.643 10</span></a> <a class="sourceLine" id="cb8-16" data-line-number="16"><span class="co"># D 0.458 0.463 0.474 0.468 0.481 0.520 10</span></a>
<a class="sourceLine" id="cb6-17" data-line-number="17"><span class="co"># E 0.465 0.477 0.534 0.497 0.556 0.804 10</span></a> <a class="sourceLine" id="cb8-17" data-line-number="17"><span class="co"># E 0.432 0.452 0.459 0.463 0.472 0.476 10</span></a>
<a class="sourceLine" id="cb6-18" data-line-number="18"><span class="co"># F 0.459 0.472 0.490 0.477 0.509 0.556 10</span></a> <a class="sourceLine" id="cb8-18" data-line-number="18"><span class="co"># F 0.427 0.454 0.461 0.461 0.471 0.487 10</span></a>
<a class="sourceLine" id="cb6-19" data-line-number="19"><span class="co"># G 0.466 0.488 0.526 0.522 0.544 0.637 10</span></a> <a class="sourceLine" id="cb8-19" data-line-number="19"><span class="co"># G 0.448 0.453 0.465 0.463 0.470 0.506 10</span></a>
<a class="sourceLine" id="cb6-20" data-line-number="20"><span class="co"># H 0.455 0.455 0.476 0.465 0.485 0.535 10</span></a></code></pre></div> <a class="sourceLine" id="cb8-20" data-line-number="20"><span class="co"># H 0.431 0.444 0.459 0.458 0.468 0.506 10</span></a></code></pre></div>
<p>Of course, when running <code><a href="../reference/mo_property.html">mo_phylum("Firmicutes")</a></code> the function has zero knowledge about the actual microorganism, namely <em>S. aureus</em>. But since the result would be <code>"Firmicutes"</code> too, there is no point in calculating the result. And because this package knows all phyla of all known bacteria (according to the Catalogue of Life), it can just return the initial value immediately.</p> <p>Of course, when running <code><a href="../reference/mo_property.html">mo_phylum("Firmicutes")</a></code> the function has zero knowledge about the actual microorganism, namely <em>S. aureus</em>. But since the result would be <code>"Firmicutes"</code> too, there is no point in calculating the result. And because this package knows all phyla of all known bacteria (according to the Catalogue of Life), it can just return the initial value immediately.</p>
</div> </div>
<div id="results-in-other-languages" class="section level3"> <div id="results-in-other-languages" class="section level3">
<h3 class="hasAnchor"> <h3 class="hasAnchor">
<a href="#results-in-other-languages" class="anchor"></a>Results in other languages</h3> <a href="#results-in-other-languages" class="anchor"></a>Results in other languages</h3>
<p>When the system language is non-English and supported by this <code>AMR</code> package, some functions will have a translated result. This almost doest take extra time:</p> <p>When the system language is non-English and supported by this <code>AMR</code> package, some functions will have a translated result. This almost doest take extra time:</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" data-line-number="1"><span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"en"</span>) <span class="co"># or just mo_name("CoNS") on an English system</span></a> <div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb9-1" data-line-number="1"><span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"en"</span>) <span class="co"># or just mo_name("CoNS") on an English system</span></a>
<a class="sourceLine" id="cb7-2" data-line-number="2"><span class="co"># [1] "Coagulase-negative Staphylococcus (CoNS)"</span></a> <a class="sourceLine" id="cb9-2" data-line-number="2"><span class="co"># [1] "Coagulase-negative Staphylococcus (CoNS)"</span></a>
<a class="sourceLine" id="cb7-3" data-line-number="3"></a> <a class="sourceLine" id="cb9-3" data-line-number="3"></a>
<a class="sourceLine" id="cb7-4" data-line-number="4"><span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"es"</span>) <span class="co"># or just mo_name("CoNS") on a Spanish system</span></a> <a class="sourceLine" id="cb9-4" data-line-number="4"><span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"es"</span>) <span class="co"># or just mo_name("CoNS") on a Spanish system</span></a>
<a class="sourceLine" id="cb7-5" data-line-number="5"><span class="co"># [1] "Staphylococcus coagulasa negativo (SCN)"</span></a> <a class="sourceLine" id="cb9-5" data-line-number="5"><span class="co"># [1] "Staphylococcus coagulasa negativo (SCN)"</span></a>
<a class="sourceLine" id="cb7-6" data-line-number="6"></a> <a class="sourceLine" id="cb9-6" data-line-number="6"></a>
<a class="sourceLine" id="cb7-7" data-line-number="7"><span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"nl"</span>) <span class="co"># or just mo_name("CoNS") on a Dutch system</span></a> <a class="sourceLine" id="cb9-7" data-line-number="7"><span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"nl"</span>) <span class="co"># or just mo_name("CoNS") on a Dutch system</span></a>
<a class="sourceLine" id="cb7-8" data-line-number="8"><span class="co"># [1] "Coagulase-negatieve Staphylococcus (CNS)"</span></a> <a class="sourceLine" id="cb9-8" data-line-number="8"><span class="co"># [1] "Coagulase-negatieve Staphylococcus (CNS)"</span></a>
<a class="sourceLine" id="cb7-9" data-line-number="9"></a> <a class="sourceLine" id="cb9-9" data-line-number="9"></a>
<a class="sourceLine" id="cb7-10" data-line-number="10">run_it &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="dt">en =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"en"</span>),</a> <a class="sourceLine" id="cb9-10" data-line-number="10">run_it &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="dt">en =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"en"</span>),</a>
<a class="sourceLine" id="cb7-11" data-line-number="11"> <span class="dt">de =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"de"</span>),</a> <a class="sourceLine" id="cb9-11" data-line-number="11"> <span class="dt">de =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"de"</span>),</a>
<a class="sourceLine" id="cb7-12" data-line-number="12"> <span class="dt">nl =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"nl"</span>),</a> <a class="sourceLine" id="cb9-12" data-line-number="12"> <span class="dt">nl =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"nl"</span>),</a>
<a class="sourceLine" id="cb7-13" data-line-number="13"> <span class="dt">es =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"es"</span>),</a> <a class="sourceLine" id="cb9-13" data-line-number="13"> <span class="dt">es =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"es"</span>),</a>
<a class="sourceLine" id="cb7-14" data-line-number="14"> <span class="dt">it =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"it"</span>),</a> <a class="sourceLine" id="cb9-14" data-line-number="14"> <span class="dt">it =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"it"</span>),</a>
<a class="sourceLine" id="cb7-15" data-line-number="15"> <span class="dt">fr =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"fr"</span>),</a> <a class="sourceLine" id="cb9-15" data-line-number="15"> <span class="dt">fr =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"fr"</span>),</a>
<a class="sourceLine" id="cb7-16" data-line-number="16"> <span class="dt">pt =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"pt"</span>),</a> <a class="sourceLine" id="cb9-16" data-line-number="16"> <span class="dt">pt =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"pt"</span>),</a>
<a class="sourceLine" id="cb7-17" data-line-number="17"> <span class="dt">times =</span> <span class="dv">10</span>)</a> <a class="sourceLine" id="cb9-17" data-line-number="17"> <span class="dt">times =</span> <span class="dv">10</span>)</a>
<a class="sourceLine" id="cb7-18" data-line-number="18"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">4</span>)</a> <a class="sourceLine" id="cb9-18" data-line-number="18"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">4</span>)</a>
<a class="sourceLine" id="cb7-19" data-line-number="19"><span class="co"># Unit: milliseconds</span></a> <a class="sourceLine" id="cb9-19" data-line-number="19"><span class="co"># Unit: milliseconds</span></a>
<a class="sourceLine" id="cb7-20" data-line-number="20"><span class="co"># expr min lq mean median uq max neval</span></a> <a class="sourceLine" id="cb9-20" data-line-number="20"><span class="co"># expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb7-21" data-line-number="21"><span class="co"># en 19.02 19.15 20.50 19.34 21.18 27.84 10</span></a> <a class="sourceLine" id="cb9-21" data-line-number="21"><span class="co"># en 17.29 17.79 18.11 18.13 18.57 18.86 10</span></a>
<a class="sourceLine" id="cb7-22" data-line-number="22"><span class="co"># de 19.56 20.25 28.34 22.84 39.77 50.78 10</span></a> <a class="sourceLine" id="cb9-22" data-line-number="22"><span class="co"># de 18.44 19.01 20.23 19.76 19.86 27.61 10</span></a>
<a class="sourceLine" id="cb7-23" data-line-number="23"><span class="co"># nl 26.12 26.25 27.73 27.17 28.60 31.65 10</span></a> <a class="sourceLine" id="cb9-23" data-line-number="23"><span class="co"># nl 23.83 24.71 26.99 25.97 26.53 39.93 10</span></a>
<a class="sourceLine" id="cb7-24" data-line-number="24"><span class="co"># es 20.02 20.58 22.36 22.26 23.95 25.71 10</span></a> <a class="sourceLine" id="cb9-24" data-line-number="24"><span class="co"># es 18.71 18.88 19.43 19.24 19.47 21.88 10</span></a>
<a class="sourceLine" id="cb7-25" data-line-number="25"><span class="co"># it 20.30 20.47 23.21 21.23 24.56 34.71 10</span></a> <a class="sourceLine" id="cb9-25" data-line-number="25"><span class="co"># it 18.48 18.84 19.40 19.50 19.84 20.57 10</span></a>
<a class="sourceLine" id="cb7-26" data-line-number="26"><span class="co"># fr 20.14 20.56 31.97 21.47 23.47 125.00 10</span></a> <a class="sourceLine" id="cb9-26" data-line-number="26"><span class="co"># fr 18.51 19.39 25.08 20.26 37.11 38.24 10</span></a>
<a class="sourceLine" id="cb7-27" data-line-number="27"><span class="co"># pt 19.83 20.24 22.74 20.46 22.65 38.93 10</span></a></code></pre></div> <a class="sourceLine" id="cb9-27" data-line-number="27"><span class="co"># pt 18.60 18.92 19.33 19.45 19.64 19.96 10</span></a></code></pre></div>
<p>Currently supported are German, Dutch, Spanish, Italian, French and Portuguese.</p> <p>Currently supported are German, Dutch, Spanish, Italian, French and Portuguese.</p>
</div> </div>
</div> </div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

View File

@ -78,7 +78,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <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.7.1.9073</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9074</span>
</span> </span>
</div> </div>

View File

@ -78,7 +78,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <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.7.1.9073</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9074</span>
</span> </span>
</div> </div>

View File

@ -42,7 +42,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <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.7.1.9073</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9074</span>
</span> </span>
</div> </div>

View File

@ -78,7 +78,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <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.7.1.9072</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9074</span>
</span> </span>
</div> </div>
@ -225,11 +225,11 @@
</div> </div>
<div id="amr-0-7-1-9072" class="section level1"> <div id="amr-0-7-1-9074" class="section level1">
<h1 class="page-header"> <h1 class="page-header">
<a href="#amr-0-7-1-9072" class="anchor"></a>AMR 0.7.1.9072<small> Unreleased </small> <a href="#amr-0-7-1-9074" class="anchor"></a>AMR 0.7.1.9074<small> Unreleased </small>
</h1> </h1>
<p><small>Last updated: 12-Sep-2019</small></p> <p><small>Last updated: 16-Sep-2019</small></p>
<div id="breaking" class="section level3"> <div id="breaking" class="section level3">
<h3 class="hasAnchor"> <h3 class="hasAnchor">
<a href="#breaking" class="anchor"></a>Breaking</h3> <a href="#breaking" class="anchor"></a>Breaking</h3>
@ -305,6 +305,17 @@ Since this is a major change, usage of the old <code>also_single_tested</code> w
<h3 class="hasAnchor"> <h3 class="hasAnchor">
<a href="#changed" class="anchor"></a>Changed</h3> <a href="#changed" class="anchor"></a>Changed</h3>
<ul> <ul>
<li>Many algorithm improvements for <code><a href="../reference/as.mo.html">as.mo()</a></code> (of which some led to additions to the <code>microorganisms</code> data set):
<ul>
<li>Self-learning algorithm - the function now gains experience from previously determined microorganism IDs and learns from it (yielding 80-95% speed improvement for any guess after the first try)</li>
<li>Big improvement for misspelled input</li>
<li>These new trivial names known to the field are now understood: meningococcus, gonococcus, pneumococcus</li>
<li>Updated to the latest taxonomic data (updated to August 2019, from the International Journal of Systematic and Evolutionary Microbiology</li>
<li>Added support for Viridans Group Streptococci (VGS) and Milleri Group Streptococci (MGS)</li>
<li>Added support for 5,000 new fungi</li>
<li>Added support for unknown yeasts and fungi</li>
</ul>
</li>
<li>Renamed data set <code>septic_patients</code> to <code>example_isolates</code> <li>Renamed data set <code>septic_patients</code> to <code>example_isolates</code>
</li> </li>
<li>Function <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code>: <li>Function <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code>:
@ -323,16 +334,6 @@ Since this is a major change, usage of the old <code>also_single_tested</code> w
</li> </li>
<li>Fix and speed improvement for <code><a href="../reference/mo_property.html">mo_shortname()</a></code> <li>Fix and speed improvement for <code><a href="../reference/mo_property.html">mo_shortname()</a></code>
</li> </li>
<li>Algorithm improvements for <code><a href="../reference/as.mo.html">as.mo()</a></code> (by which some additions were made to the <code>microorganisms</code> data set:
<ul>
<li>Big improvement for misspelled input</li>
<li>These new trivial names known to the field are now understood: meningococcus, gonococcus, pneumococcus</li>
<li>Updated to the latest taxonomic data (updated to August 2019, from the International Journal of Systematic and Evolutionary Microbiology</li>
<li>Added support for Viridans Group Streptococci (VGS) and Milleri Group Streptococci (MGS)</li>
<li>Added support for 5,000 new fungi</li>
<li>Added support for unknown yeasts and fungi</li>
</ul>
</li>
<li>Fix for using <code>mo_*</code> functions where the coercion uncertainties and failures would not be available through <code><a href="../reference/as.mo.html">mo_uncertainties()</a></code> and <code><a href="../reference/as.mo.html">mo_failures()</a></code> anymore</li> <li>Fix for using <code>mo_*</code> functions where the coercion uncertainties and failures would not be available through <code><a href="../reference/as.mo.html">mo_uncertainties()</a></code> and <code><a href="../reference/as.mo.html">mo_failures()</a></code> anymore</li>
<li>Deprecated the <code>country</code> parameter of <code><a href="../reference/mdro.html">mdro()</a></code> in favour of the already existing <code>guideline</code> parameter to support multiple guidelines within one country</li> <li>Deprecated the <code>country</code> parameter of <code><a href="../reference/mdro.html">mdro()</a></code> in favour of the already existing <code>guideline</code> parameter to support multiple guidelines within one country</li>
<li>The <code>name</code> of <code>RIF</code> is now Rifampicin instead of Rifampin</li> <li>The <code>name</code> of <code>RIF</code> is now Rifampicin instead of Rifampin</li>
@ -1264,7 +1265,7 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
<div id="tocnav"> <div id="tocnav">
<h2>Contents</h2> <h2>Contents</h2>
<ul class="nav nav-pills nav-stacked"> <ul class="nav nav-pills nav-stacked">
<li><a href="#amr-0-7-1-9072">0.7.1.9072</a></li> <li><a href="#amr-0-7-1-9074">0.7.1.9074</a></li>
<li><a href="#amr-0-7-1">0.7.1</a></li> <li><a href="#amr-0-7-1">0.7.1</a></li>
<li><a href="#amr-0-7-0">0.7.0</a></li> <li><a href="#amr-0-7-0">0.7.0</a></li>
<li><a href="#amr-0-6-1">0.6.1</a></li> <li><a href="#amr-0-6-1">0.6.1</a></li>

View File

@ -78,7 +78,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <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.7.1.9073</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9074</span>
</span> </span>
</div> </div>

View File

@ -1 +1 @@
"","x","mo","uncertainty_level","package_v" "x","mo","uncertainty_level","package_version"

1 x mo uncertainty_level package_version package_v