ab_info, other bug fixes

This commit is contained in:
dr. M.S. (Matthijs) Berends 2019-05-16 21:20:00 +02:00
parent f6bf54b37d
commit 4c3cf85a65
57 changed files with 519 additions and 430 deletions

View File

@ -69,7 +69,7 @@ R-release:
- '*.Rcheck/*'
expire_in: '1 month'
cache:
key: "$CI_COMMIT_REF_SLUG"
key: "r350"
paths:
- installed_deps/
@ -98,13 +98,17 @@ R-devel:
paths:
- '*.Rcheck/*'
expire_in: '1 month'
cache:
key: "r360"
paths:
- installed_deps/
coverage:
stage: test
allow_failure: true
when: on_success
cache:
key: "$CI_COMMIT_REF_SLUG"
key: "r350"
paths:
- installed_deps/
only:
@ -121,17 +125,18 @@ coverage:
pages:
stage: deploy
when: always
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- installed_deps/
#cache:
# key: "$CI_COMMIT_REF_SLUG"
# paths:
# - installed_deps/
only:
- master
script:
- mv docs public
# install missing and outdated packages
- Rscript -e 'source(".gitlab-ci.R"); gl_update_pkg_all(repos = "https://cran.rstudio.com", quiet = TRUE, install_pkgdown = TRUE)'
- Rscript -e "devtools::install(build = TRUE, upgrade = FALSE)"
- R -e "pkgdown::build_site(examples = FALSE, lazy = TRUE, override = list(destination = 'public'))"
#- Rscript -e 'source(".gitlab-ci.R"); gl_update_pkg_all(repos = "https://cran.rstudio.com", quiet = TRUE, install_pkgdown = TRUE)'
#- Rscript -e "devtools::install(build = TRUE, upgrade = FALSE)"
#- R -e "pkgdown::build_site(examples = FALSE, lazy = TRUE, override = list(destination = 'public'))"
artifacts:
paths:
- public

View File

@ -1,6 +1,6 @@
Package: AMR
Version: 0.6.1.9003
Date: 2019-05-13
Date: 2019-05-16
Title: Antimicrobial Resistance Analysis
Authors@R: c(
person(

47
R/ab.R
View File

@ -52,7 +52,7 @@
#' as.ab(" eryt 123")
#' as.ab("ERYT")
#' as.ab("ERY")
#' as.ab("erytromicine") # spelled wrong
#' as.ab("eritromicine") # spelled wrong, yet works
#' as.ab("Erythrocin") # trade name
#' as.ab("Romycin") # trade name
#'
@ -64,13 +64,20 @@ as.ab <- function(x) {
if (is.ab(x)) {
return(x)
}
if (all(toupper(x) %in% AMR::antibiotics$ab)) {
# valid AB code, but not yet right class
return(structure(.Data = toupper(x),
class = "ab"))
}
x_bak <- x
# remove suffices
x_bak_clean <- gsub("_(mic|rsi|disk|disc)$", "", x)
x_bak_clean <- gsub("_(mic|rsi|disk|disc)$", "", x, ignore.case = TRUE)
# remove disk concentrations, like LVX_NM -> LVX
x_bak_clean <- gsub("_[A-Z]{2}[0-9_]{0,3}$", "", x_bak_clean, ignore.case = TRUE)
# clean rest of it
x_bak_clean <- gsub("[^a-zA-Z0-9/-]", "", x_bak_clean)
x_bak_clean <- gsub("[^A-Z0-9/-]", "", x_bak_clean, ignore.case = TRUE)
# keep only a-z when it's not an ATC code or only numbers
x_bak_clean[!x_bak_clean %like% "^([A-Z][0-9]{2}[A-Z]{2}[0-9]{2}|[0-9]+)$"] <- gsub("[^a-zA-Z]+",
"",
@ -156,19 +163,25 @@ as.ab <- function(x) {
x_unknown <- c(x_unknown, x_bak[x[i] == x_bak_clean][1])
next
}
x_spelling <- x[i]
x_spelling <- gsub("[iy]+", "[iy]+", x_spelling, ignore.case = TRUE)
x_spelling <- gsub("[sz]+", "[sz]+", x_spelling, ignore.case = TRUE)
x_spelling <- gsub("(c|k|q|qu)+", "(c|k|q|qu)+", x_spelling, ignore.case = TRUE)
x_spelling <- gsub("(ph|f|v)+", "(ph|f|v)+", x_spelling, ignore.case = TRUE)
x_spelling <- gsub("(th|t)+", "(th|t)+", x_spelling, ignore.case = TRUE)
x_spelling <- gsub("a+", "a+", x_spelling, ignore.case = TRUE)
x_spelling <- gsub("e+", "e+", x_spelling, ignore.case = TRUE)
x_spelling <- gsub("o+", "o+", x_spelling, ignore.case = TRUE)
x_spelling <- tolower(x[i])
x_spelling <- gsub("[iy]+", "[iy]+", x_spelling)
x_spelling <- gsub("[sz]+", "[sz]+", x_spelling)
x_spelling <- gsub("(c|k|q|qu)+", "(c|k|q|qu)+", x_spelling)
x_spelling <- gsub("(ph|f|v)+", "(ph|f|v)+", x_spelling)
x_spelling <- gsub("(th|t)+", "(th|t)+", x_spelling)
x_spelling <- gsub("(x|ks)+", "(x|ks)+", x_spelling)
x_spelling <- gsub("a+", "a+", x_spelling)
x_spelling <- gsub("e+", "e+", x_spelling)
x_spelling <- gsub("o+", "o+", x_spelling)
# allow start with C/S/Z
x_spelling <- gsub("^(\\(c\\|k\\|q\\|qu\\)|\\[sz\\])", "(c|k|q|qu|s|z)", x_spelling)
x_spelling <- gsub("(c|k|q|qu)+[sz]", "(c|k|q|qu|s|x|z)", x_spelling, fixed = TRUE)
# allow any ending of -in/-ine and -im/-ime
x_spelling <- gsub("(\\[iy\\]\\+(n|m)|\\[iy\\]\\+(n|m)e\\+)$", "[iy]+(n|m)e*", x_spelling, ignore.case = TRUE)
x_spelling <- gsub("(\\[iy\\]\\+(n|m)|\\[iy\\]\\+(n|m)e\\+)$", "[iy]+(n|m)e*", x_spelling)
# allow any ending of -ol/-ole
x_spelling <- gsub("(o\\+l|o\\+le\\+)$", "o+le*", x_spelling, ignore.case = TRUE)
x_spelling <- gsub("(o\\+l|o\\+le\\+)$", "o+le*", x_spelling)
# allow any ending of -on/-one
x_spelling <- gsub("(o\\+n|o\\+ne\\+)$", "o+ne*", x_spelling)
# try if name starts with it
found <- AMR::antibiotics[which(AMR::antibiotics$name %like% paste0("^", x_spelling)),]$ab
if (length(found) > 0) {
@ -203,11 +216,15 @@ as.ab <- function(x) {
left_join(data.frame(x = x, x_new = x_new, stringsAsFactors = FALSE), by = "x") %>%
pull(x_new)
if (length(x_result) == 0) {
x_result <- NA_character_
}
structure(.Data = x_result,
class = "ab")
}
#' @rdname as.atc
#' @rdname as.ab
#' @export
is.ab <- function(x) {
identical(class(x), "ab")

View File

@ -35,7 +35,7 @@
#' @name ab_property
#' @return \itemize{
#' \item{An \code{integer} in case of \code{ab_cid}}
#' \item{A named \code{list} in case of multiple \code{ab_synonyms}}
#' \item{A named \code{list} in case of \code{ab_info} and multiple \code{ab_synonyms}/\code{ab_tradenames}}
#' \item{A \code{double} in case of \code{ab_ddd}}
#' \item{A \code{character} in all other cases}
#' }
@ -64,6 +64,8 @@
#' ab_ddd("AMX", "iv") # 1
#' ab_ddd("AMX", "iv", units = TRUE) # "g"
#'
#' ab_info("AMX") # all properties as a list
#'
#' # all ab_* functions use as.ab() internally:
#' ab_name("Fluclox") # "Flucloxacillin"
#' ab_name("fluklox") # "Flucloxacillin"
@ -113,20 +115,20 @@ ab_tradenames <- function(x, ...) {
#' @rdname ab_property
#' @export
ab_group <- function(x, ...) {
ab_validate(x = x, property = "group", ...)
ab_group <- function(x, language = get_locale(), ...) {
t(ab_validate(x = x, property = "group", ...), language = language)
}
#' @rdname ab_property
#' @export
ab_atc_group1 <- function(x, ...) {
ab_validate(x = x, property = "atc_group1", ...)
ab_atc_group1 <- function(x, language = get_locale(), ...) {
t(ab_validate(x = x, property = "atc_group1", ...), language = language)
}
#' @rdname ab_property
#' @export
ab_atc_group2 <- function(x, ...) {
ab_validate(x = x, property = "atc_group2", ...)
ab_atc_group2 <- function(x, language = get_locale(), ...) {
t(ab_validate(x = x, property = "atc_group2", ...), language = language)
}
#' @rdname ab_property
@ -144,6 +146,22 @@ ab_ddd <- function(x, administration = "oral", units = FALSE, ...) {
ab_validate(x = x, property = ddd_prop, ...)
}
ab_info <- function(x, language = get_locale(), ...) {
x <- AMR::as.ab(x, ...)
base::list(ab = x,
atc = ab_atc(x),
cid = ab_cid(x),
name = ab_name(x, language = language),
group = ab_group(x, language = language),
atc_group1 = ab_atc_group1(x, language = language),
atc_group2 = ab_atc_group2(x, language = language),
tradenames = ab_tradenames(x),
ddd = list(oral = list(amount = ab_ddd(x, administration = "oral", units = FALSE),
units = ab_ddd(x, administration = "oral", units = TRUE)),
iv = list(amount = ab_ddd(x, administration = "iv", units = FALSE),
units = ab_ddd(x, administration = "iv", units = TRUE))))
}
#' @rdname ab_property
#' @export
ab_property <- function(x, property = 'name', language = get_locale(), ...) {
@ -169,8 +187,8 @@ ab_validate <- function(x, property, ...) {
error = function(e) stop(e$message, call. = FALSE))
if (!all(x %in% AMR::antibiotics[, property])) {
x <- data.frame(ab = as.ab(x), stringsAsFactors = FALSE) %>%
left_join(antibiotics %>% select(c("ab", property)), by = "ab") %>%
x <- data.frame(ab = AMR::as.ab(x), stringsAsFactors = FALSE) %>%
left_join(AMR::antibiotics, by = "ab") %>%
pull(property)
}
if (property %in% c("ab", "atc")) {

View File

@ -33,7 +33,7 @@
#'
#' In the ATC classification system, the active substances are classified in a hierarchy with five different levels. The system has fourteen main anatomical/pharmacological groups or 1st levels. Each ATC main group is divided into 2nd levels which could be either pharmacological or therapeutic groups. The 3rd and 4th levels are chemical, pharmacological or therapeutic subgroups and the 5th level is the chemical substance. The 2nd, 3rd and 4th levels are often used to identify pharmacological subgroups when that is considered more appropriate than therapeutic or chemical subgroups.
#' Source: \url{https://www.whocc.no/atc/structure_and_principles/}
#' @return Character (vector) with class \code{"act"}. Unknown values will return \code{NA}.
#' @return Character (vector) with class \code{"atc"}. Unknown values will return \code{NA}.
#' @seealso \code{\link{antibiotics}} for the dataframe that is being used to determine ATCs.
#' @inheritSection AMR Read more on our website!
#' @examples

View File

@ -250,7 +250,8 @@ frequency_tbl <- function(x,
if (length(user_exprs) > 0) {
new_list <- list(0)
for (i in 1:length(user_exprs)) {
new_list[[i]] <- eval_tidy(user_exprs[[i]], data = x)
new_list[[i]] <- tryCatch(eval_tidy(user_exprs[[i]], data = x),
error = function(e) stop(e$message, call. = FALSE))
if (length(new_list[[i]]) == 1) {
if (is.character(new_list[[i]]) & new_list[[i]] %in% colnames(x)) {
# support septic_patients %>% freq("hospital_id")
@ -330,8 +331,27 @@ frequency_tbl <- function(x,
cols <- NULL
# mult.columns <- 2
} else {
x.name <- NULL
cols <- NULL
x.name <- deparse(substitute(x))
if (x.name %like% "[$]") {
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
x.obj <- tryCatch(get(x.name), error = function(e) NULL)
x.name <- paste0("`", x.name , "`")
if (!is.null(x.obj)) {
x.name <- paste0(x.name,
" (",
x.obj %>%
dim() %>%
format(decimal.mark = decimal.mark, big.mark = big.mark) %>%
trimws() %>%
paste(collapse = " x "),
")")
}
} else {
x.name <- NULL
cols <- NULL
}
}
if (!is.null(ncol(x))) {
@ -566,7 +586,7 @@ format_header <- function(x, markdown = FALSE, decimal.mark = ".", big.mark = ",
# rsi
if (has_length == TRUE & any(x_class == "rsi")) {
ab <- tryCatch(as.ab(attributes(x)$opt$vars), error = function(e) NA)
if (!is.na(ab)) {
if (!is.na(ab) & isTRUE(length(ab) > 0)) {
header$drug <- paste0(ab_name(ab[1L]), " (", ab[1L], ", ", ab_atc(ab[1L]), ")")
header$group <- ab_group(ab[1L])
}

View File

@ -390,9 +390,12 @@ t <- function(from, language = get_locale()) {
df_trans$fixed[is.na(df_trans$fixed)] <- TRUE
# check if text to look for is in one of the patterns
pattern_total <- tryCatch(paste0("(", paste(df_trans$pattern, collapse = "|"), ")"),
error = "")
if (NROW(df_trans) == 0 | !any(from %like% pattern_total)) {
any_form_in_patterns <- tryCatch(any(from %like% paste0("(", paste(df_trans$pattern, collapse = "|"), ")")),
error = function(e) {
warning("Translation not possible. Please open an issue on GitLab (https://gitlab.com/msberends/AMR/issues) or GitHub (https://github.com/msberends/AMR/issues).", call. = FALSE)
return(FALSE)
})
if (NROW(df_trans) == 0 | !any_form_in_patterns) {
return(from)
}

1
R/mo.R
View File

@ -349,6 +349,7 @@ exec_as.mo <- function(x,
# 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)) {
x <- gsub("^F_CANDD_GLB$", "F_CANDD_GLA", x) # specific old code for C. glabrata
leftpart <- gsub("^([BFP]_[A-Z]{3,7}).*", "\\1", x)
if (any(leftpart %in% names(mo_codes_v0.5.0))) {
rightpart <- gsub("^[BFP]_[A-Z]{3,7}(.*)", "\\1", x)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -192,7 +192,7 @@
<h1>How to conduct AMR analysis</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">12 May 2019</h4>
<h4 class="date">16 May 2019</h4>
<div class="hidden name"><code>AMR.Rmd</code></div>
@ -201,7 +201,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 12 May 2019.</p>
<p><strong>Note:</strong> values on this page will change with every website update since they are based on randomly created values and the page was written in <a href="https://rmarkdown.rstudio.com/">R Markdown</a>. However, the methodology remains unchanged. This page was generated on 16 May 2019.</p>
<div id="introduction" class="section level1">
<h1 class="hasAnchor">
<a href="#introduction" class="anchor"></a>Introduction</h1>
@ -217,21 +217,21 @@
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2019-05-12</td>
<td align="center">2019-05-16</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-05-12</td>
<td align="center">2019-05-16</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-05-12</td>
<td align="center">2019-05-16</td>
<td align="center">efgh</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
@ -327,70 +327,70 @@
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2016-07-20</td>
<td align="center">N4</td>
<td align="center">Hospital A</td>
<td align="center">Klebsiella pneumoniae</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="even">
<td align="center">2013-12-24</td>
<td align="center">L1</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">2010-04-21</td>
<td align="center">C10</td>
<td align="center">2013-05-13</td>
<td align="center">X4</td>
<td align="center">Hospital D</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">I</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="even">
<td align="center">2015-07-23</td>
<td align="center">A3</td>
<td align="center">Hospital B</td>
<td align="center">Streptococcus pneumoniae</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-10-17</td>
<td align="center">V7</td>
<td align="center">Hospital A</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2014-09-20</td>
<td align="center">X4</td>
<td align="center">2016-09-19</td>
<td align="center">G9</td>
<td align="center">Hospital A</td>
<td align="center">Escherichia coli</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>
</tr>
<tr class="odd">
<td align="center">2015-09-22</td>
<td align="center">L6</td>
<td align="center">Hospital D</td>
<td align="center">Escherichia coli</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>
<tr class="even">
<td align="center">2017-09-13</td>
<td align="center">N3</td>
<td align="center">Hospital D</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">2015-12-01</td>
<td align="center">Z3</td>
<td align="center">Hospital A</td>
<td align="center">Escherichia coli</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">2011-02-25</td>
<td align="center">F10</td>
<td align="center">Hospital B</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">M</td>
</tr>
</tbody>
</table>
@ -411,8 +411,8 @@
#&gt;
#&gt; Item Count Percent Cum. Count Cum. Percent
#&gt; --- ----- ------- -------- ----------- -------------
#&gt; 1 M 10,367 51.8% 10,367 51.8%
#&gt; 2 F 9,633 48.2% 20,000 100.0%</code></pre>
#&gt; 1 M 10,410 52.0% 10,410 52.0%
#&gt; 2 F 9,590 48.0% 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>
@ -442,14 +442,14 @@
<a class="sourceLine" id="cb14-18" title="18"><span class="co">#&gt; Pasteurella multocida (no new changes)</span></a>
<a class="sourceLine" id="cb14-19" title="19"><span class="co">#&gt; Staphylococcus (no new changes)</span></a>
<a class="sourceLine" id="cb14-20" title="20"><span class="co">#&gt; Streptococcus groups A, B, C, G (no new changes)</span></a>
<a class="sourceLine" id="cb14-21" title="21"><span class="co">#&gt; Streptococcus pneumoniae (1473 new changes)</span></a>
<a class="sourceLine" id="cb14-21" title="21"><span class="co">#&gt; Streptococcus pneumoniae (1532 new changes)</span></a>
<a class="sourceLine" id="cb14-22" title="22"><span class="co">#&gt; Viridans group streptococci (no new changes)</span></a>
<a class="sourceLine" id="cb14-23" title="23"><span class="co">#&gt; </span></a>
<a class="sourceLine" id="cb14-24" title="24"><span class="co">#&gt; EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes (v3.1, 2016)</span></a>
<a class="sourceLine" id="cb14-25" title="25"><span class="co">#&gt; Table 01: Intrinsic resistance in Enterobacteriaceae (1282 new changes)</span></a>
<a class="sourceLine" id="cb14-25" title="25"><span class="co">#&gt; Table 01: Intrinsic resistance in Enterobacteriaceae (1341 new changes)</span></a>
<a class="sourceLine" id="cb14-26" title="26"><span class="co">#&gt; 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">#&gt; 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">#&gt; Table 04: Intrinsic resistance in Gram-positive bacteria (2691 new changes)</span></a>
<a class="sourceLine" id="cb14-28" title="28"><span class="co">#&gt; Table 04: Intrinsic resistance in Gram-positive bacteria (2834 new changes)</span></a>
<a class="sourceLine" id="cb14-29" title="29"><span class="co">#&gt; 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">#&gt; 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">#&gt; Table 11: Interpretive rules for macrolides, lincosamides, and streptogramins (no new changes)</span></a>
@ -457,24 +457,24 @@
<a class="sourceLine" id="cb14-33" title="33"><span class="co">#&gt; Table 13: Interpretive rules for quinolones (no new changes)</span></a>
<a class="sourceLine" id="cb14-34" title="34"><span class="co">#&gt; </span></a>
<a class="sourceLine" id="cb14-35" title="35"><span class="co">#&gt; Other rules</span></a>
<a class="sourceLine" id="cb14-36" title="36"><span class="co">#&gt; Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2218 new changes)</span></a>
<a class="sourceLine" id="cb14-37" title="37"><span class="co">#&gt; Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (124 new changes)</span></a>
<a class="sourceLine" id="cb14-36" title="36"><span class="co">#&gt; Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2225 new changes)</span></a>
<a class="sourceLine" id="cb14-37" title="37"><span class="co">#&gt; Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (109 new changes)</span></a>
<a class="sourceLine" id="cb14-38" title="38"><span class="co">#&gt; Non-EUCAST: piperacillin = R where piperacillin/tazobactam = R (no new changes)</span></a>
<a class="sourceLine" id="cb14-39" title="39"><span class="co">#&gt; Non-EUCAST: piperacillin/tazobactam = S where piperacillin = S (no new changes)</span></a>
<a class="sourceLine" id="cb14-40" title="40"><span class="co">#&gt; Non-EUCAST: trimethoprim = R where trimethoprim/sulfa = R (no new changes)</span></a>
<a class="sourceLine" id="cb14-41" title="41"><span class="co">#&gt; Non-EUCAST: trimethoprim/sulfa = S where trimethoprim = S (no new changes)</span></a>
<a class="sourceLine" id="cb14-42" title="42"><span class="co">#&gt; </span></a>
<a class="sourceLine" id="cb14-43" title="43"><span class="co">#&gt; --------------------------------------------------------------------------</span></a>
<a class="sourceLine" id="cb14-44" title="44"><span class="co">#&gt; EUCAST rules affected 6,442 out of 20,000 rows, making a total of 7,788 edits</span></a>
<a class="sourceLine" id="cb14-44" title="44"><span class="co">#&gt; EUCAST rules affected 6,633 out of 20,000 rows, making a total of 8,041 edits</span></a>
<a class="sourceLine" id="cb14-45" title="45"><span class="co">#&gt; =&gt; added 0 test results</span></a>
<a class="sourceLine" id="cb14-46" title="46"><span class="co">#&gt; </span></a>
<a class="sourceLine" id="cb14-47" title="47"><span class="co">#&gt; =&gt; changed 7,788 test results</span></a>
<a class="sourceLine" id="cb14-48" title="48"><span class="co">#&gt; - 105 test results changed from S to I</span></a>
<a class="sourceLine" id="cb14-49" title="49"><span class="co">#&gt; - 4,678 test results changed from S to R</span></a>
<a class="sourceLine" id="cb14-50" title="50"><span class="co">#&gt; - 1,081 test results changed from I to S</span></a>
<a class="sourceLine" id="cb14-51" title="51"><span class="co">#&gt; - 315 test results changed from I to R</span></a>
<a class="sourceLine" id="cb14-52" title="52"><span class="co">#&gt; - 1,587 test results changed from R to S</span></a>
<a class="sourceLine" id="cb14-53" title="53"><span class="co">#&gt; - 22 test results changed from R to I</span></a>
<a class="sourceLine" id="cb14-47" title="47"><span class="co">#&gt; =&gt; changed 8,041 test results</span></a>
<a class="sourceLine" id="cb14-48" title="48"><span class="co">#&gt; - 118 test results changed from S to I</span></a>
<a class="sourceLine" id="cb14-49" title="49"><span class="co">#&gt; - 4,906 test results changed from S to R</span></a>
<a class="sourceLine" id="cb14-50" title="50"><span class="co">#&gt; - 1,094 test results changed from I to S</span></a>
<a class="sourceLine" id="cb14-51" title="51"><span class="co">#&gt; - 326 test results changed from I to R</span></a>
<a class="sourceLine" id="cb14-52" title="52"><span class="co">#&gt; - 1,577 test results changed from R to S</span></a>
<a class="sourceLine" id="cb14-53" title="53"><span class="co">#&gt; - 20 test results changed from R to I</span></a>
<a class="sourceLine" id="cb14-54" title="54"><span class="co">#&gt; --------------------------------------------------------------------------</span></a>
<a class="sourceLine" id="cb14-55" title="55"><span class="co">#&gt; </span></a>
<a class="sourceLine" id="cb14-56" title="56"><span class="co">#&gt; Use verbose = TRUE to get a data.frame with all specified edits instead.</span></a></code></pre></div>
@ -502,8 +502,8 @@
<a class="sourceLine" id="cb16-3" title="3"><span class="co">#&gt; </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">#&gt; </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">#&gt; </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; =&gt; Found 5,682 first isolates (28.4% of total)</span></a></code></pre></div>
<p>So only 28.4% is suitable for resistance analysis! We can now filter on it with the <code><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; =&gt; Found 5,706 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>
<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>
@ -529,19 +529,19 @@
<tbody>
<tr class="odd">
<td align="center">1</td>
<td align="center">2010-01-10</td>
<td align="center">H7</td>
<td align="center">2010-01-31</td>
<td align="center">O3</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">TRUE</td>
</tr>
<tr class="even">
<td align="center">2</td>
<td align="center">2010-01-23</td>
<td align="center">H7</td>
<td align="center">2010-04-24</td>
<td align="center">O3</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
@ -551,19 +551,19 @@
</tr>
<tr class="odd">
<td align="center">3</td>
<td align="center">2010-05-15</td>
<td align="center">H7</td>
<td align="center">2010-04-26</td>
<td align="center">O3</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">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="even">
<td align="center">4</td>
<td align="center">2010-08-16</td>
<td align="center">H7</td>
<td align="center">2010-05-07</td>
<td align="center">O3</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
@ -573,63 +573,63 @@
</tr>
<tr class="odd">
<td align="center">5</td>
<td align="center">2010-09-26</td>
<td align="center">H7</td>
<td align="center">2010-07-07</td>
<td align="center">O3</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="even">
<td align="center">6</td>
<td align="center">2010-11-01</td>
<td align="center">H7</td>
<td align="center">2010-07-28</td>
<td align="center">O3</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">I</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>
</tr>
<tr class="odd">
<td align="center">7</td>
<td align="center">2010-12-11</td>
<td align="center">H7</td>
<td align="center">2010-08-30</td>
<td align="center">O3</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">FALSE</td>
</tr>
<tr class="even">
<td align="center">8</td>
<td align="center">2011-02-11</td>
<td align="center">H7</td>
<td align="center">2010-09-08</td>
<td align="center">O3</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">TRUE</td>
</tr>
<tr class="odd">
<td align="center">9</td>
<td align="center">2011-03-16</td>
<td align="center">H7</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">I</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">9</td>
<td align="center">2010-10-11</td>
<td align="center">O3</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">FALSE</td>
</tr>
<tr class="even">
<td align="center">10</td>
<td align="center">2011-04-14</td>
<td align="center">H7</td>
<td align="center">2010-11-11</td>
<td align="center">O3</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
@ -639,7 +639,7 @@
</tr>
</tbody>
</table>
<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>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>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>
@ -650,7 +650,7 @@
<a class="sourceLine" id="cb19-7" title="7"><span class="co">#&gt; </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">#&gt; </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">#&gt; [Criterion] Inclusion based on key antibiotics, ignoring I.</span></a>
<a class="sourceLine" id="cb19-10" title="10"><span class="co">#&gt; =&gt; Found 15,036 first weighted isolates (75.2% of total)</span></a></code></pre></div>
<a class="sourceLine" id="cb19-10" title="10"><span class="co">#&gt; =&gt; Found 15,027 first weighted isolates (75.1% of total)</span></a></code></pre></div>
<table class="table">
<thead><tr class="header">
<th align="center">isolate</th>
@ -667,20 +667,20 @@
<tbody>
<tr class="odd">
<td align="center">1</td>
<td align="center">2010-01-10</td>
<td align="center">H7</td>
<td align="center">2010-01-31</td>
<td align="center">O3</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">TRUE</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2</td>
<td align="center">2010-01-23</td>
<td align="center">H7</td>
<td align="center">2010-04-24</td>
<td align="center">O3</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
@ -691,20 +691,20 @@
</tr>
<tr class="odd">
<td align="center">3</td>
<td align="center">2010-05-15</td>
<td align="center">H7</td>
<td align="center">2010-04-26</td>
<td align="center">O3</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">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">4</td>
<td align="center">2010-08-16</td>
<td align="center">H7</td>
<td align="center">2010-05-07</td>
<td align="center">O3</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
@ -715,23 +715,23 @@
</tr>
<tr class="odd">
<td align="center">5</td>
<td align="center">2010-09-26</td>
<td align="center">H7</td>
<td align="center">2010-07-07</td>
<td align="center">O3</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="even">
<td align="center">6</td>
<td align="center">2010-11-01</td>
<td align="center">H7</td>
<td align="center">2010-07-28</td>
<td align="center">O3</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">I</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>
@ -739,11 +739,11 @@
</tr>
<tr class="odd">
<td align="center">7</td>
<td align="center">2010-12-11</td>
<td align="center">H7</td>
<td align="center">2010-08-30</td>
<td align="center">O3</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">FALSE</td>
@ -751,32 +751,32 @@
</tr>
<tr class="even">
<td align="center">8</td>
<td align="center">2011-02-11</td>
<td align="center">H7</td>
<td align="center">2010-09-08</td>
<td align="center">O3</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>
<td align="center">TRUE</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">9</td>
<td align="center">2011-03-16</td>
<td align="center">H7</td>
<td align="center">2010-10-11</td>
<td align="center">O3</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">I</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">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">10</td>
<td align="center">2011-04-14</td>
<td align="center">H7</td>
<td align="center">2010-11-11</td>
<td align="center">O3</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
@ -787,11 +787,11 @@
</tr>
</tbody>
</table>
<p>Instead of 2, now 9 isolates are flagged. In total, 75.2% 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>Instead of 1, now 10 isolates are flagged. In total, 75.1% of all isolates are marked first weighted - 46.6% 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,036 isolates for analysis.</p>
<p>So we end up with 15,027 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>
@ -817,75 +817,11 @@
<tbody>
<tr class="odd">
<td>1</td>
<td align="center">2016-07-20</td>
<td align="center">N4</td>
<td align="center">Hospital A</td>
<td align="center">B_KLBSL_PNE</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">R</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">TRUE</td>
</tr>
<tr class="even">
<td>3</td>
<td align="center">2010-04-21</td>
<td align="center">C10</td>
<td align="center">Hospital D</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">M</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="odd">
<td>4</td>
<td align="center">2015-07-23</td>
<td align="center">A3</td>
<td align="center">Hospital B</td>
<td align="center">B_STRPT_PNE</td>
<td align="center">S</td>
<td align="center">S</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="even">
<td>5</td>
<td align="center">2011-10-17</td>
<td align="center">V7</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">R</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="odd">
<td>6</td>
<td align="center">2014-09-20</td>
<td align="center">2013-05-13</td>
<td align="center">X4</td>
<td align="center">Hospital B</td>
<td align="center">Hospital D</td>
<td align="center">B_STPHY_AUR</td>
<td align="center">S</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
@ -896,11 +832,43 @@
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td>7</td>
<td align="center">2015-09-29</td>
<td align="center">S7</td>
<td>2</td>
<td align="center">2016-09-19</td>
<td align="center">G9</td>
<td align="center">Hospital A</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">M</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="odd">
<td>3</td>
<td align="center">2015-09-22</td>
<td align="center">L6</td>
<td align="center">Hospital D</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">M</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>5</td>
<td align="center">2015-12-01</td>
<td align="center">Z3</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">S</td>
@ -911,6 +879,38 @@
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td>6</td>
<td align="center">2011-02-25</td>
<td align="center">F10</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">R</td>
<td align="center">R</td>
<td align="center">M</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>7</td>
<td align="center">2010-08-13</td>
<td align="center">G10</td>
<td align="center">Hospital C</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">M</td>
<td align="center">Gram negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
</tbody>
</table>
<p>Time for the analysis!</p>
@ -928,9 +928,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,036 x 13)</strong></p>
<p><strong>Frequency table of <code>genus</code> and <code>species</code> from a <code>data.frame</code> (15,027 x 13)</strong></p>
<p>Columns: 2<br>
Length: 15,036 (of which NA: 0 = 0.00%)<br>
Length: 15,027 (of which NA: 0 = 0.00%)<br>
Unique: 4</p>
<p>Shortest: 16<br>
Longest: 24</p>
@ -947,33 +947,33 @@ Longest: 24</p>
<tr class="odd">
<td align="left">1</td>
<td align="left">Escherichia coli</td>
<td align="right">7,441</td>
<td align="right">49.5%</td>
<td align="right">7,441</td>
<td align="right">49.5%</td>
<td align="right">7,318</td>
<td align="right">48.7%</td>
<td align="right">7,318</td>
<td align="right">48.7%</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">Staphylococcus aureus</td>
<td align="right">3,779</td>
<td align="right">25.1%</td>
<td align="right">11,220</td>
<td align="right">74.6%</td>
<td align="right">3,729</td>
<td align="right">24.8%</td>
<td align="right">11,047</td>
<td align="right">73.5%</td>
</tr>
<tr class="odd">
<td align="left">3</td>
<td align="left">Streptococcus pneumoniae</td>
<td align="right">2,278</td>
<td align="right">15.2%</td>
<td align="right">13,498</td>
<td align="right">89.8%</td>
<td align="right">2,370</td>
<td align="right">15.8%</td>
<td align="right">13,417</td>
<td align="right">89.3%</td>
</tr>
<tr class="even">
<td align="left">4</td>
<td align="left">Klebsiella pneumoniae</td>
<td align="right">1,538</td>
<td align="right">10.2%</td>
<td align="right">15,036</td>
<td align="right">1,610</td>
<td align="right">10.7%</td>
<td align="right">15,027</td>
<td align="right">100.0%</td>
</tr>
</tbody>
@ -984,7 +984,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. They 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_IR</a></span>(AMX)</a>
<a class="sourceLine" id="cb25-2" title="2"><span class="co">#&gt; [1] 0.494879</span></a></code></pre></div>
<a class="sourceLine" id="cb25-2" title="2"><span class="co">#&gt; [1] 0.4973714</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>
@ -997,19 +997,19 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Hospital A</td>
<td align="center">0.5024412</td>
<td align="center">0.4993375</td>
</tr>
<tr class="even">
<td align="center">Hospital B</td>
<td align="center">0.5015980</td>
<td align="center">0.4931245</td>
</tr>
<tr class="odd">
<td align="center">Hospital C</td>
<td align="center">0.4683146</td>
<td align="center">0.5068182</td>
</tr>
<tr class="even">
<td align="center">Hospital D</td>
<td align="center">0.4912927</td>
<td align="center">0.4949396</td>
</tr>
</tbody>
</table>
@ -1027,23 +1027,23 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Hospital A</td>
<td align="center">0.5024412</td>
<td align="center">4506</td>
<td align="center">0.4993375</td>
<td align="center">4528</td>
</tr>
<tr class="even">
<td align="center">Hospital B</td>
<td align="center">0.5015980</td>
<td align="center">5319</td>
<td align="center">0.4931245</td>
<td align="center">5236</td>
</tr>
<tr class="odd">
<td align="center">Hospital C</td>
<td align="center">0.4683146</td>
<td align="center">2225</td>
<td align="center">0.5068182</td>
<td align="center">2200</td>
</tr>
<tr class="even">
<td align="center">Hospital D</td>
<td align="center">0.4912927</td>
<td align="center">2986</td>
<td align="center">0.4949396</td>
<td align="center">3063</td>
</tr>
</tbody>
</table>
@ -1063,27 +1063,27 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Escherichia</td>
<td align="center">0.8770327</td>
<td align="center">0.8982664</td>
<td align="center">0.9908614</td>
<td align="center">0.8800219</td>
<td align="center">0.8938234</td>
<td align="center">0.9885215</td>
</tr>
<tr class="even">
<td align="center">Klebsiella</td>
<td align="center">0.7418726</td>
<td align="center">0.9037711</td>
<td align="center">0.9817945</td>
<td align="center">0.7136646</td>
<td align="center">0.9012422</td>
<td align="center">0.9732919</td>
</tr>
<tr class="odd">
<td align="center">Staphylococcus</td>
<td align="center">0.8840963</td>
<td align="center">0.9237894</td>
<td align="center">0.9886213</td>
<td align="center">0.8806651</td>
<td align="center">0.9115044</td>
<td align="center">0.9895414</td>
</tr>
<tr class="even">
<td align="center">Streptococcus</td>
<td align="center">0.5697981</td>
<td align="center">0.5751055</td>
<td align="center">0.0000000</td>
<td align="center">0.5697981</td>
<td align="center">0.5751055</td>
</tr>
</tbody>
</table>
@ -1167,13 +1167,13 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td>IR</td>
<td align="left">24</td>
<td align="left">33</td>
<td align="left">25</td>
<td align="left">77</td>
</tr>
<tr class="even">
<td>S</td>
<td align="left">25</td>
<td align="left">77</td>
<td align="left">24</td>
<td align="left">33</td>
</tr>
</tbody>
</table>
@ -1194,10 +1194,10 @@ Longest: 24</p>
<a class="sourceLine" id="cb34-14" title="14"><span class="co">#&gt; p-value = 0.03104</span></a>
<a class="sourceLine" id="cb34-15" title="15"><span class="co">#&gt; alternative hypothesis: true odds ratio is not equal to 1</span></a>
<a class="sourceLine" id="cb34-16" title="16"><span class="co">#&gt; 95 percent confidence interval:</span></a>
<a class="sourceLine" id="cb34-17" title="17"><span class="co">#&gt; 1.054283 4.735995</span></a>
<a class="sourceLine" id="cb34-17" title="17"><span class="co">#&gt; 0.2111489 0.9485124</span></a>
<a class="sourceLine" id="cb34-18" title="18"><span class="co">#&gt; sample estimates:</span></a>
<a class="sourceLine" id="cb34-19" title="19"><span class="co">#&gt; odds ratio </span></a>
<a class="sourceLine" id="cb34-20" title="20"><span class="co">#&gt; 2.228006</span></a></code></pre></div>
<a class="sourceLine" id="cb34-20" title="20"><span class="co">#&gt; 0.4488318</span></a></code></pre></div>
<p>As can be seen, the p value is 0.03, which means that the fosfomycin resistances found in hospital A and D are really different.</p>
</div>
</div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

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="Released version">0.6.0</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9003</span>
</span>
</div>
@ -105,7 +105,7 @@
</a>
</li>
<li>
<a href="../reference/atc_property.html">
<a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span>
Get properties of an antibiotic
@ -192,7 +192,7 @@
<h1>How to apply EUCAST rules</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">27 March 2019</h4>
<h4 class="date">16 May 2019</h4>
<div class="hidden name"><code>EUCAST.Rmd</code></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="Released version">0.6.0</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9003</span>
</span>
</div>
@ -105,7 +105,7 @@
</a>
</li>
<li>
<a href="../reference/atc_property.html">
<a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span>
Get properties of an antibiotic
@ -192,7 +192,7 @@
<h1>How to use the <em>G</em>-test</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">27 March 2019</h4>
<h4 class="date">16 May 2019</h4>
<div class="hidden name"><code>G_test.Rmd</code></div>

View File

@ -192,7 +192,7 @@
<h1>How to import data from SPSS / SAS / Stata</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">12 May 2019</h4>
<h4 class="date">16 May 2019</h4>
<div class="hidden name"><code>SPSS.Rmd</code></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="Released version">0.6.0</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9003</span>
</span>
</div>
@ -105,7 +105,7 @@
</a>
</li>
<li>
<a href="../reference/atc_property.html">
<a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span>
Get properties of an antibiotic
@ -192,7 +192,7 @@
<h1>How to work with WHONET data</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">27 March 2019</h4>
<h4 class="date">16 May 2019</h4>
<div class="hidden name"><code>WHONET.Rmd</code></div>
@ -336,12 +336,13 @@ Species: 38</p>
<a class="sourceLine" id="cb5-3" title="3"><span class="co"># amoxicillin/clavulanic acid (J01CR02) as an example</span></a>
<a class="sourceLine" id="cb5-4" title="4">data <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(AMC_ND2)</a></code></pre></div>
<p><strong>Frequency table of <code>AMC_ND2</code> from a <code>data.frame</code> (500 x 54)</strong></p>
<pre><code># Warning: These values could not be coerced to a valid atc: "AMCND".</code></pre>
<p>Class: <code>factor</code> &gt; <code>ordered</code> &gt; <code>rsi</code> (<code>numeric</code>)<br>
Length: 500 (of which NA: 19 = 3.80%)<br>
Levels: 3: <code>S</code> &lt; <code>I</code> &lt; <code>R</code><br>
Unique: 3</p>
<p>%IR: 25.99%</p>
<p>Drug: Amoxicillin/clavulanic acid (AMC, J01CR02)<br>
Group: Beta-lactams/penicillins<br>
%SI: 78.59%</p>
<table class="table">
<thead><tr class="header">
<th align="left"></th>

View File

@ -192,7 +192,7 @@
<h1>How to get properties of an antibiotic</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">12 May 2019</h4>
<h4 class="date">16 May 2019</h4>
<div class="hidden name"><code>ab_property.Rmd</code></div>

View File

@ -192,7 +192,7 @@
<h1>Benchmarks</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">12 May 2019</h4>
<h4 class="date">16 May 2019</h4>
<div class="hidden name"><code>benchmarks.Rmd</code></div>
@ -217,14 +217,14 @@
<a class="sourceLine" id="cb2-8" title="8"> <span class="dt">times =</span> <span class="dv">10</span>)</a>
<a class="sourceLine" id="cb2-9" title="9"><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-10" title="10"><span class="co">#&gt; Unit: milliseconds</span></a>
<a class="sourceLine" id="cb2-11" title="11"><span class="co">#&gt; expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb2-12" title="12"><span class="co">#&gt; as.mo("sau") 17.0 17.0 22.0 18 18 65 10</span></a>
<a class="sourceLine" id="cb2-13" title="13"><span class="co">#&gt; as.mo("stau") 47.0 47.0 52.0 47 48 92 10</span></a>
<a class="sourceLine" id="cb2-14" title="14"><span class="co">#&gt; as.mo("staaur") 17.0 18.0 18.0 18 18 18 10</span></a>
<a class="sourceLine" id="cb2-15" title="15"><span class="co">#&gt; as.mo("STAAUR") 17.0 18.0 32.0 18 62 77 10</span></a>
<a class="sourceLine" id="cb2-16" title="16"><span class="co">#&gt; as.mo("S. aureus") 28.0 28.0 37.0 28 30 72 10</span></a>
<a class="sourceLine" id="cb2-17" title="17"><span class="co">#&gt; as.mo("S. aureus") 28.0 28.0 46.0 29 72 110 10</span></a>
<a class="sourceLine" id="cb2-18" title="18"><span class="co">#&gt; as.mo("Staphylococcus aureus") 7.9 7.9 8.4 8 8 12 10</span></a></code></pre></div>
<a class="sourceLine" id="cb2-11" title="11"><span class="co">#&gt; expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb2-12" title="12"><span class="co">#&gt; as.mo("sau") 17.0 18 26 18.0 18.0 65 10</span></a>
<a class="sourceLine" id="cb2-13" title="13"><span class="co">#&gt; as.mo("stau") 47.0 47 52 48.0 49.0 92 10</span></a>
<a class="sourceLine" id="cb2-14" title="14"><span class="co">#&gt; as.mo("staaur") 17.0 18 22 18.0 18.0 62 10</span></a>
<a class="sourceLine" id="cb2-15" title="15"><span class="co">#&gt; as.mo("STAAUR") 18.0 18 24 18.0 18.0 78 10</span></a>
<a class="sourceLine" id="cb2-16" title="16"><span class="co">#&gt; as.mo("S. aureus") 28.0 28 37 28.0 30.0 73 10</span></a>
<a class="sourceLine" id="cb2-17" title="17"><span class="co">#&gt; as.mo("S. aureus") 28.0 28 46 28.0 72.0 120 10</span></a>
<a class="sourceLine" id="cb2-18" title="18"><span class="co">#&gt; as.mo("Staphylococcus aureus") 7.9 8 13 8.3 8.5 52 10</span></a></code></pre></div>
<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>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" title="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>
@ -236,12 +236,12 @@
<a class="sourceLine" id="cb3-7" title="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-8" title="8"><span class="co">#&gt; Unit: milliseconds</span></a>
<a class="sourceLine" id="cb3-9" title="9"><span class="co">#&gt; expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb3-10" title="10"><span class="co">#&gt; as.mo("theisl") 470 470 490 480 520 530 10</span></a>
<a class="sourceLine" id="cb3-11" title="11"><span class="co">#&gt; as.mo("THEISL") 470 520 520 520 520 530 10</span></a>
<a class="sourceLine" id="cb3-12" title="12"><span class="co">#&gt; as.mo("T. islandicus") 75 76 76 76 76 77 10</span></a>
<a class="sourceLine" id="cb3-13" title="13"><span class="co">#&gt; as.mo("T. islandicus") 76 76 86 77 79 130 10</span></a>
<a class="sourceLine" id="cb3-14" title="14"><span class="co">#&gt; as.mo("Thermus islandicus") 74 74 89 75 120 120 10</span></a></code></pre></div>
<p>That takes 8.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-10" title="10"><span class="co">#&gt; as.mo("theisl") 470 470 490 470 520 530 10</span></a>
<a class="sourceLine" id="cb3-11" title="11"><span class="co">#&gt; as.mo("THEISL") 470 470 490 480 520 530 10</span></a>
<a class="sourceLine" id="cb3-12" title="12"><span class="co">#&gt; as.mo("T. islandicus") 76 76 91 77 120 120 10</span></a>
<a class="sourceLine" id="cb3-13" title="13"><span class="co">#&gt; as.mo("T. islandicus") 76 76 90 76 120 120 10</span></a>
<a class="sourceLine" id="cb3-14" title="14"><span class="co">#&gt; as.mo("Thermus islandicus") 74 74 95 81 120 130 10</span></a></code></pre></div>
<p>That takes 8 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 very uncommon):</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/graphics/topics/par">par</a></span>(<span class="dt">mar =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="dv">5</span>, <span class="dv">16</span>, <span class="dv">4</span>, <span class="dv">2</span>)) <span class="co"># set more space for left margin text (16)</span></a>
<a class="sourceLine" id="cb4-2" title="2"></a>
@ -286,9 +286,9 @@
<a class="sourceLine" id="cb5-23" title="23"> <span class="dt">times =</span> <span class="dv">10</span>)</a>
<a class="sourceLine" id="cb5-24" title="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="cb5-25" title="25"><span class="co">#&gt; Unit: milliseconds</span></a>
<a class="sourceLine" id="cb5-26" title="26"><span class="co">#&gt; expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb5-27" title="27"><span class="co">#&gt; mo_fullname(x) 836 837 893 883 925 1000 10</span></a></code></pre></div>
<p>So transforming 500,000 values (!!) of 50 unique values only takes 0.88 seconds (882 ms). You only lose time on your unique input values.</p>
<a class="sourceLine" id="cb5-26" title="26"><span class="co">#&gt; expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb5-27" title="27"><span class="co">#&gt; mo_fullname(x) 732 811 816 817 819 941 10</span></a></code></pre></div>
<p>So transforming 500,000 values (!!) of 50 unique values only takes 0.82 seconds (817 ms). You only lose time on your unique input values.</p>
</div>
<div id="precalculated-results" class="section level3">
<h3 class="hasAnchor">
@ -301,9 +301,9 @@
<a class="sourceLine" id="cb6-5" title="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="cb6-6" title="6"><span class="co">#&gt; Unit: milliseconds</span></a>
<a class="sourceLine" id="cb6-7" title="7"><span class="co">#&gt; expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb6-8" title="8"><span class="co">#&gt; A 12.80 13.10 13.20 13.20 13.20 13.50 10</span></a>
<a class="sourceLine" id="cb6-9" title="9"><span class="co">#&gt; B 25.20 25.30 30.00 25.60 25.90 69.70 10</span></a>
<a class="sourceLine" id="cb6-10" title="10"><span class="co">#&gt; C 1.26 1.37 1.58 1.69 1.72 1.73 10</span></a></code></pre></div>
<a class="sourceLine" id="cb6-8" title="8"><span class="co">#&gt; A 12.80 12.90 13.30 13.30 13.60 14.20 10</span></a>
<a class="sourceLine" id="cb6-9" title="9"><span class="co">#&gt; B 25.40 25.60 30.70 25.90 27.40 70.80 10</span></a>
<a class="sourceLine" id="cb6-10" title="10"><span class="co">#&gt; C 1.25 1.36 1.54 1.68 1.69 1.74 10</span></a></code></pre></div>
<p>So going from <code><a href="../reference/mo_property.html">mo_fullname("Staphylococcus aureus")</a></code> to <code>"Staphylococcus aureus"</code> takes 0.0017 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="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" title="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="cb7-2" title="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>
@ -317,14 +317,14 @@
<a class="sourceLine" id="cb7-10" title="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="cb7-11" title="11"><span class="co">#&gt; Unit: milliseconds</span></a>
<a class="sourceLine" id="cb7-12" title="12"><span class="co">#&gt; expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb7-13" title="13"><span class="co">#&gt; A 0.429 0.441 0.486 0.491 0.510 0.562 10</span></a>
<a class="sourceLine" id="cb7-14" title="14"><span class="co">#&gt; B 0.437 0.521 0.555 0.577 0.596 0.651 10</span></a>
<a class="sourceLine" id="cb7-15" title="15"><span class="co">#&gt; C 1.300 1.460 1.730 1.890 1.900 1.960 10</span></a>
<a class="sourceLine" id="cb7-16" title="16"><span class="co">#&gt; D 0.444 0.531 0.565 0.563 0.619 0.704 10</span></a>
<a class="sourceLine" id="cb7-17" title="17"><span class="co">#&gt; E 0.399 0.431 0.471 0.471 0.508 0.535 10</span></a>
<a class="sourceLine" id="cb7-18" title="18"><span class="co">#&gt; F 0.344 0.396 0.432 0.445 0.471 0.500 10</span></a>
<a class="sourceLine" id="cb7-19" title="19"><span class="co">#&gt; G 0.390 0.397 0.464 0.465 0.492 0.624 10</span></a>
<a class="sourceLine" id="cb7-20" title="20"><span class="co">#&gt; H 0.201 0.222 0.291 0.303 0.339 0.423 10</span></a></code></pre></div>
<a class="sourceLine" id="cb7-13" title="13"><span class="co">#&gt; A 0.403 0.504 0.523 0.531 0.563 0.627 10</span></a>
<a class="sourceLine" id="cb7-14" title="14"><span class="co">#&gt; B 0.431 0.542 0.620 0.640 0.685 0.785 10</span></a>
<a class="sourceLine" id="cb7-15" title="15"><span class="co">#&gt; C 1.310 1.450 1.640 1.650 1.880 1.980 10</span></a>
<a class="sourceLine" id="cb7-16" title="16"><span class="co">#&gt; D 0.427 0.468 0.599 0.566 0.597 0.943 10</span></a>
<a class="sourceLine" id="cb7-17" title="17"><span class="co">#&gt; E 0.406 0.510 0.542 0.526 0.593 0.715 10</span></a>
<a class="sourceLine" id="cb7-18" title="18"><span class="co">#&gt; F 0.358 0.422 0.492 0.481 0.511 0.678 10</span></a>
<a class="sourceLine" id="cb7-19" title="19"><span class="co">#&gt; G 0.349 0.425 0.487 0.485 0.512 0.661 10</span></a>
<a class="sourceLine" id="cb7-20" title="20"><span class="co">#&gt; H 0.204 0.292 0.360 0.341 0.434 0.528 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>
</div>
<div id="results-in-other-languages" class="section level3">
@ -351,13 +351,13 @@
<a class="sourceLine" id="cb8-18" title="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="cb8-19" title="19"><span class="co">#&gt; Unit: milliseconds</span></a>
<a class="sourceLine" id="cb8-20" title="20"><span class="co">#&gt; expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb8-21" title="21"><span class="co">#&gt; en 18.01 18.11 18.30 18.27 18.35 18.78 10</span></a>
<a class="sourceLine" id="cb8-22" title="22"><span class="co">#&gt; de 22.91 23.00 27.53 23.03 23.28 67.49 10</span></a>
<a class="sourceLine" id="cb8-23" title="23"><span class="co">#&gt; nl 35.30 35.42 44.34 35.49 35.90 79.60 10</span></a>
<a class="sourceLine" id="cb8-24" title="24"><span class="co">#&gt; es 22.98 23.02 23.18 23.09 23.31 23.58 10</span></a>
<a class="sourceLine" id="cb8-25" title="25"><span class="co">#&gt; it 22.82 22.89 23.02 22.95 23.19 23.29 10</span></a>
<a class="sourceLine" id="cb8-26" title="26"><span class="co">#&gt; fr 22.95 23.05 23.08 23.08 23.10 23.36 10</span></a>
<a class="sourceLine" id="cb8-27" title="27"><span class="co">#&gt; pt 22.99 23.06 32.00 23.16 23.32 67.65 10</span></a></code></pre></div>
<a class="sourceLine" id="cb8-21" title="21"><span class="co">#&gt; en 18.16 18.21 18.27 18.23 18.25 18.53 10</span></a>
<a class="sourceLine" id="cb8-22" title="22"><span class="co">#&gt; de 23.02 23.12 23.25 23.19 23.40 23.62 10</span></a>
<a class="sourceLine" id="cb8-23" title="23"><span class="co">#&gt; nl 35.25 35.46 40.22 35.93 36.49 79.63 10</span></a>
<a class="sourceLine" id="cb8-24" title="24"><span class="co">#&gt; es 22.97 23.07 27.79 23.34 23.69 68.06 10</span></a>
<a class="sourceLine" id="cb8-25" title="25"><span class="co">#&gt; it 22.91 22.91 32.09 23.21 23.96 67.71 10</span></a>
<a class="sourceLine" id="cb8-26" title="26"><span class="co">#&gt; fr 23.10 23.13 27.95 23.46 23.65 67.64 10</span></a>
<a class="sourceLine" id="cb8-27" title="27"><span class="co">#&gt; pt 22.96 23.07 23.22 23.14 23.42 23.63 10</span></a></code></pre></div>
<p>Currently supported are German, Dutch, Spanish, Italian, French and Portuguese.</p>
</div>
</div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -192,7 +192,7 @@
<h1>How to create frequency tables</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">12 May 2019</h4>
<h4 class="date">16 May 2019</h4>
<div class="hidden name"><code>freq.Rmd</code></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="Released version">0.6.0</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9003</span>
</span>
</div>
@ -105,7 +105,7 @@
</a>
</li>
<li>
<a href="../reference/atc_property.html">
<a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span>
Get properties of an antibiotic
@ -192,7 +192,7 @@
<h1>How to get properties of a microorganism</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">27 March 2019</h4>
<h4 class="date">16 May 2019</h4>
<div class="hidden name"><code>mo_property.Rmd</code></div>

View File

@ -192,7 +192,7 @@
<h1>How to predict antimicrobial resistance</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">13 May 2019</h4>
<h4 class="date">16 May 2019</h4>
<div class="hidden name"><code>resistance_predict.Rmd</code></div>

View File

@ -67,6 +67,8 @@ $( document ).ready(function() {
x = x.replace("Alex", "Prof Dr Alex");
x = x.replace("Bhanu", "Prof Dr Bhanu");
x = x.replace(/Author, thesis advisor/g, "Doctoral advisor");
x = x.replace(/Author, maintainer./g, "");
x = x.replace(/Author./g, "");
}
return(x);
}

View File

@ -315,9 +315,9 @@
<p>It <strong>cleanses existing data</strong> by providing new <em>classes</em> for microoganisms, antibiotics and antimicrobial results (both S/I/R and MIC). By installing this package, you teach R everything about microbiology that is needed for analysis. These functions all use intelligent rules to guess results that you would expect:</p>
<ul>
<li>Use <code><a href="reference/as.mo.html">as.mo()</a></code> to get a microbial ID. The IDs are human readable for the trained eye - the ID of <em>Klebsiella pneumoniae</em> is “B_KLBSL_PNE” (B stands for Bacteria) and the ID of <em>S. aureus</em> is “B_STPHY_AUR”. The function takes almost any text as input that looks like the name or code of a microorganism like “E. coli”, “esco” or “esccol” and tries to find expected results using intelligent rules combined with the included Catalogue of Life data set. It only takes milliseconds to find results, please see our <a href="./articles/benchmarks.html">benchmarks</a>. Moreover, it can group <em>Staphylococci</em> into coagulase negative and positive (CoNS and CoPS, see <a href="./reference/as.mo.html#source">source</a>) and can categorise <em>Streptococci</em> into Lancefield groups (like beta-haemolytic <em>Streptococcus</em> Group B, <a href="./reference/as.mo.html#source">source</a>).</li>
<li>Use <code><a href="reference/as.ab.html">as.ab()</a></code> to get an antibiotic ID. Like microbial IDs, these IDs are also human readable based on those used by EARS-Net. For example, the ID of amoxicillin is <code>AMX</code> and the ID of gentamicin is <code>GEN</code>. The <code><a href="reference/as.ab.html">as.ab()</a></code> function also uses intelligent rules to find results like accepting misspelling, trade names and abbrevations used in many laboratory systems. For instance, the values “Furabid”, “Furadantin”, “nitro” all return the ID of Nitrofurantoine. To accomplish this, the package contains a database with most LIS codes, official names, trade names, DDDs and categories of antibiotics. The function <code><a href="reference/as.atc.html">as.atc()</a></code> will return the ATC code of an antibiotic as defined by the WHO.</li>
<li>Use <code><a href="reference/as.rsi.html">as.rsi()</a></code> to get antibiotic interpretations based on raw MIC values (in mg/L) or disk diffusion values (in mm), or transform existing values to valid antimicrobial results. It produces just S, I or R based on your input and warns about invalid values. Even values like “&lt;=0.002; S” (combined MIC/RSI) will result in “S”.</li>
<li>Use <code><a href="reference/as.mic.html">as.mic()</a></code> to cleanse your MIC values. It produces a so-called factor (called <em>ordinal</em> in SPSS) with valid MIC values as levels. A value like “&lt;=0.002; S” (combined MIC/RSI) will result in “&lt;=0.002”.</li>
<li>Use <code><a href="reference/as.ab.html">as.ab()</a></code> to get a antibiotic ID, which are abbreviations used by EARS-Net whenever available. Use <code><a href="reference/as.atc.html">as.atc()</a></code> to get the ATC code of an antibiotic as defined by the WHO. This package contains a database with most LIS codes, official names, DDDs and even trade names of antibiotics. For example, the values “Furabid”, “Furadantin”, “nitro” all return the ID of Nitrofurantoine.</li>
</ul>
</li>
<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="Released version">0.6.0</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9003</span>
</span>
</div>
@ -145,7 +145,7 @@
</a>
</li>
<li>
<a href="../reference/atc_property.html">
<a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span>
Get properties of an antibiotic

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="Released version">0.6.0</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9003</span>
</span>
</div>
@ -145,7 +145,7 @@
</a>
</li>
<li>
<a href="../reference/atc_property.html">
<a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span>
Get properties of an antibiotic
@ -271,7 +271,7 @@
<dt><code>Inducible clindamycin resistance</code></dt><dd><p>Clindamycin can be induced?</p></dd>
<dt><code>Comment</code></dt><dd><p>Other comments</p></dd>
<dt><code>Date of data entry</code></dt><dd><p>Date this data was entered in WHONET</p></dd>
<dt><code>AMP_ND10:CIP_EE</code></dt><dd><p>27 different antibiotics. You can lookup the abbreviatons in the <code><a href='antibiotics.html'>antibiotics</a></code> data set, or use e.g. <code><a href='atc_property.html'>atc_name</a>("AMP")</code> to get the official name immediately. Before analysis, you should transform this to a valid antibiotic class, using <code><a href='as.rsi.html'>as.rsi</a></code>.</p></dd>
<dt><code>AMP_ND10:CIP_EE</code></dt><dd><p>27 different antibiotics. You can lookup the abbreviatons in the <code><a href='antibiotics.html'>antibiotics</a></code> data set, or use e.g. <code><a href='AMR-deprecated.html'>atc_name</a>("AMP")</code> to get the official name immediately. Before analysis, you should transform this to a valid antibiotic class, using <code><a href='as.rsi.html'>as.rsi</a></code>.</p></dd>
</dl>
<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

@ -251,11 +251,11 @@
<span class='fu'>ab_tradenames</span>(<span class='no'>x</span>, <span class='no'>...</span>)
<span class='fu'>ab_group</span>(<span class='no'>x</span>, <span class='no'>...</span>)
<span class='fu'>ab_group</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'><a href='translate.html'>get_locale</a></span>(), <span class='no'>...</span>)
<span class='fu'>ab_atc_group1</span>(<span class='no'>x</span>, <span class='no'>...</span>)
<span class='fu'>ab_atc_group1</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'><a href='translate.html'>get_locale</a></span>(), <span class='no'>...</span>)
<span class='fu'>ab_atc_group2</span>(<span class='no'>x</span>, <span class='no'>...</span>)
<span class='fu'>ab_atc_group2</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'><a href='translate.html'>get_locale</a></span>(), <span class='no'>...</span>)
<span class='fu'>ab_ddd</span>(<span class='no'>x</span>, <span class='kw'>administration</span> <span class='kw'>=</span> <span class='st'>"oral"</span>, <span class='kw'>units</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>, <span class='no'>...</span>)
@ -299,7 +299,7 @@
<ul>
<li><p>An <code>integer</code> in case of <code>ab_cid</code></p></li>
<li><p>A named <code>list</code> in case of multiple <code>ab_synonyms</code></p></li>
<li><p>A named <code>list</code> in case of <code>ab_info</code> and multiple <code>ab_synonyms</code>/<code>ab_tradenames</code></p></li>
<li><p>A <code>double</code> in case of <code>ab_ddd</code></p></li>
<li><p>A <code>character</code> in all other cases</p></li>
</ul>
@ -349,6 +349,8 @@
<span class='fu'>ab_ddd</span>(<span class='st'>"AMX"</span>, <span class='st'>"iv"</span>) <span class='co'># 1</span>
<span class='fu'>ab_ddd</span>(<span class='st'>"AMX"</span>, <span class='st'>"iv"</span>, <span class='kw'>units</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>) <span class='co'># "g"</span>
<span class='fu'>ab_info</span>(<span class='st'>"AMX"</span>) <span class='co'># all properties as a list</span>
<span class='co'># all ab_* functions use as.ab() internally:</span>
<span class='fu'>ab_name</span>(<span class='st'>"Fluclox"</span>) <span class='co'># "Flucloxacillin"</span>
<span class='fu'>ab_name</span>(<span class='st'>"fluklox"</span>) <span class='co'># "Flucloxacillin"</span>

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="Released version">0.6.0</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9003</span>
</span>
</div>
@ -145,7 +145,7 @@
</a>
</li>
<li>
<a href="../reference/atc_property.html">
<a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span>
Get properties of an antibiotic

View File

@ -241,7 +241,9 @@
</div>
<pre class="usage"><span class='fu'>as.ab</span>(<span class='no'>x</span>)</pre>
<pre class="usage"><span class='fu'>as.ab</span>(<span class='no'>x</span>)
<span class='fu'>is.ab</span>(<span class='no'>x</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
@ -298,7 +300,7 @@ This package contains <strong>all ~450 antimicrobial drugs</strong> and their An
<span class='fu'>as.ab</span>(<span class='st'>" eryt 123"</span>)
<span class='fu'>as.ab</span>(<span class='st'>"ERYT"</span>)
<span class='fu'>as.ab</span>(<span class='st'>"ERY"</span>)
<span class='fu'>as.ab</span>(<span class='st'>"erytromicine"</span>) <span class='co'># spelled wrong</span>
<span class='fu'>as.ab</span>(<span class='st'>"eritromicine"</span>) <span class='co'># spelled wrong, yet works</span>
<span class='fu'>as.ab</span>(<span class='st'>"Erythrocin"</span>) <span class='co'># trade name</span>
<span class='fu'>as.ab</span>(<span class='st'>"Romycin"</span>) <span class='co'># trade name</span>

View File

@ -6,7 +6,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Transform to ATC code — is.ab • AMR (for R)</title>
<title>Transform to ATC code — as.atc • AMR (for R)</title>
<!-- favicons -->
<link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png">
@ -45,7 +45,7 @@
<link href="../extra.css" rel="stylesheet">
<script src="../extra.js"></script>
<meta property="og:title" content="Transform to ATC code — is.ab" />
<meta property="og:title" content="Transform to ATC code — as.atc" />
<meta property="og:description" content="Use this function to determine the ATC code of one or more antibiotics. The data set antibiotics will be searched for abbreviations, official names and trade names." />
@ -241,9 +241,7 @@
</div>
<pre class="usage"><span class='fu'>is.ab</span>(<span class='no'>x</span>)
<span class='fu'>as.atc</span>(<span class='no'>x</span>)
<pre class="usage"><span class='fu'>as.atc</span>(<span class='no'>x</span>)
<span class='fu'>is.atc</span>(<span class='no'>x</span>)</pre>
@ -258,7 +256,7 @@
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
<p>Character (vector) with class <code>"act"</code>. Unknown values will return <code>NA</code>.</p>
<p>Character (vector) with class <code>"atc"</code>. Unknown values will return <code>NA</code>.</p>
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</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="Released version">0.6.0</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9003</span>
</span>
</div>
@ -145,7 +145,7 @@
</a>
</li>
<li>
<a href="../reference/atc_property.html">
<a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span>
Get properties of an antibiotic

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="Released version">0.6.0</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9003</span>
</span>
</div>
@ -145,7 +145,7 @@
</a>
</li>
<li>
<a href="../reference/atc_property.html">
<a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span>
Get properties of an antibiotic

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="Released version">0.6.0</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9003</span>
</span>
</div>
@ -145,7 +145,7 @@
</a>
</li>
<li>
<a href="../reference/atc_property.html">
<a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span>
Get properties of an antibiotic

View File

@ -281,13 +281,13 @@
<tr>
<td>
<p><code><a href="as.ab.html">as.ab()</a></code> </p>
<p><code><a href="as.ab.html">as.ab()</a></code> <code><a href="as.ab.html">is.ab()</a></code> </p>
</td>
<td><p>Transform to antibiotic ID</p></td>
</tr><tr>
<td>
<p><code><a href="as.atc.html">is.ab()</a></code> <code><a href="as.atc.html">as.atc()</a></code> <code><a href="as.atc.html">is.atc()</a></code> </p>
<p><code><a href="as.atc.html">as.atc()</a></code> <code><a href="as.atc.html">is.atc()</a></code> </p>
</td>
<td><p>Transform to ATC code</p></td>
</tr><tr>

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="Released version">0.6.0</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9003</span>
</span>
</div>
@ -145,7 +145,7 @@
</a>
</li>
<li>
<a href="../reference/atc_property.html">
<a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span>
Get properties of an antibiotic

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="Released version">0.6.0</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9003</span>
</span>
</div>
@ -145,7 +145,7 @@
</a>
</li>
<li>
<a href="../reference/atc_property.html">
<a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span>
Get properties of an antibiotic

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="Released version">0.6.0</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9003</span>
</span>
</div>
@ -145,7 +145,7 @@
</a>
</li>
<li>
<a href="../reference/atc_property.html">
<a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span>
Get properties of an antibiotic

View File

@ -81,7 +81,7 @@ This is the fastest way to have your organisation (or analysis) specific codes p
</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="Released version">0.6.0</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9003</span>
</span>
</div>
@ -146,7 +146,7 @@ This is the fastest way to have your organisation (or analysis) specific codes p
</a>
</li>
<li>
<a href="../reference/atc_property.html">
<a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span>
Get properties of an antibiotic

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="Released version">0.6.0</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9003</span>
</span>
</div>
@ -145,7 +145,7 @@
</a>
</li>
<li>
<a href="../reference/atc_property.html">
<a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span>
Get properties of an antibiotic

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="Released version">0.6.0</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9003</span>
</span>
</div>
@ -145,7 +145,7 @@
</a>
</li>
<li>
<a href="../reference/atc_property.html">
<a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span>
Get properties of an antibiotic

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="Released version">0.6.0</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9003</span>
</span>
</div>
@ -145,7 +145,7 @@
</a>
</li>
<li>
<a href="../reference/atc_property.html">
<a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span>
Get properties of an antibiotic
@ -255,7 +255,7 @@
<dt><code>gender</code></dt><dd><p>gender of the patient</p></dd>
<dt><code>patient_id</code></dt><dd><p>ID of the patient, first 10 characters of an SHA hash containing irretrievable information</p></dd>
<dt><code>mo</code></dt><dd><p>ID of microorganism created with <code><a href='as.mo.html'>as.mo</a></code>, see also <code><a href='microorganisms.html'>microorganisms</a></code></p></dd>
<dt><code>peni:rifa</code></dt><dd><p>40 different antibiotics with class <code>rsi</code> (see <code><a href='as.rsi.html'>as.rsi</a></code>); these column names occur in <code><a href='antibiotics.html'>antibiotics</a></code> data set and can be translated with <code><a href='abname.html'>abname</a></code></p></dd>
<dt><code>peni:rifa</code></dt><dd><p>40 different antibiotics with class <code>rsi</code> (see <code><a href='as.rsi.html'>as.rsi</a></code>); these column names occur in <code><a href='antibiotics.html'>antibiotics</a></code> data set and can be translated with <code><a href='AMR-deprecated.html'>abname</a></code></p></dd>
</dl>
<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

@ -81,7 +81,7 @@ When negative: the left tail is longer; the mass of the distribution is concentr
</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="Released version">0.6.0</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9003</span>
</span>
</div>
@ -146,7 +146,7 @@ When negative: the left tail is longer; the mass of the distribution is concentr
</a>
</li>
<li>
<a href="../reference/atc_property.html">
<a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span>
Get properties of an antibiotic

View File

@ -134,9 +134,9 @@ The `AMR` package basically does four important things:
1. It **cleanses existing data** by providing new *classes* for microoganisms, antibiotics and antimicrobial results (both S/I/R and MIC). By installing this package, you teach R everything about microbiology that is needed for analysis. These functions all use intelligent rules to guess results that you would expect:
* Use `as.mo()` to get a microbial ID. The IDs are human readable for the trained eye - the ID of *Klebsiella pneumoniae* is "B_KLBSL_PNE" (B stands for Bacteria) and the ID of *S. aureus* is "B_STPHY_AUR". The function takes almost any text as input that looks like the name or code of a microorganism like "E. coli", "esco" or "esccol" and tries to find expected results using intelligent rules combined with the included Catalogue of Life data set. It only takes milliseconds to find results, please see our [benchmarks](./articles/benchmarks.html). Moreover, it can group *Staphylococci* into coagulase negative and positive (CoNS and CoPS, see [source](./reference/as.mo.html#source)) and can categorise *Streptococci* into Lancefield groups (like beta-haemolytic *Streptococcus* Group B, [source](./reference/as.mo.html#source)).
* Use `as.ab()` to get an antibiotic ID. Like microbial IDs, these IDs are also human readable based on those used by EARS-Net. For example, the ID of amoxicillin is `AMX` and the ID of gentamicin is `GEN`. The `as.ab()` function also uses intelligent rules to find results like accepting misspelling, trade names and abbrevations used in many laboratory systems. For instance, the values "Furabid", "Furadantin", "nitro" all return the ID of Nitrofurantoine. To accomplish this, the package contains a database with most LIS codes, official names, trade names, DDDs and categories of antibiotics. The function `as.atc()` will return the ATC code of an antibiotic as defined by the WHO.
* Use `as.rsi()` to get antibiotic interpretations based on raw MIC values (in mg/L) or disk diffusion values (in mm), or transform existing values to valid antimicrobial results. It produces just S, I or R based on your input and warns about invalid values. Even values like "<=0.002; S" (combined MIC/RSI) will result in "S".
* Use `as.mic()` to cleanse your MIC values. It produces a so-called factor (called *ordinal* in SPSS) with valid MIC values as levels. A value like "<=0.002; S" (combined MIC/RSI) will result in "<=0.002".
* Use `as.ab()` to get a antibiotic ID, which are abbreviations used by EARS-Net whenever available. Use `as.atc()` to get the ATC code of an antibiotic as defined by the WHO. This package contains a database with most LIS codes, official names, DDDs and even trade names of antibiotics. For example, the values "Furabid", "Furadantin", "nitro" all return the ID of Nitrofurantoine.
2. It **enhances existing data** and **adds new data** from data sets included in this package.

View File

@ -191,7 +191,7 @@ nl Cefmetazole Cefmetazol
nl Cefodizime Cefodizim
nl Cefonicid Cefonicide
nl Cefoperazone Cefoperazon
nl Cefoperazone/beta-lactamase inhibitor Cefoperazon combinatiepreparaten
nl Cefoperazone/beta-lactamase inhibitor Cefoperazon/enzymremmer
nl Cefotaxime Cefotaxim
nl Cefoxitin Cefoxitine
nl Cefpirome Cefpirom
@ -297,8 +297,8 @@ nl Quinupristin/dalfopristin Quinupristine/dalfopristine
nl Ribostamycin Ribostamycine
nl Rifabutin Rifabutine
nl Rifampicin Rifampicine
nl Rifampicin, pyrazinamide, ethambutol/isoniazid Rifampicine/pyrazinamide, ethambutol en isoniazide
nl Rifampicin, pyrazinamide/isoniazid Rifampicine/pyrazinamide en isoniazide
nl Rifampicin/pyrazinamide/ethambutol/isoniazid Rifampicine/pyrazinamide/ethambutol/isoniazide
nl Rifampicin/pyrazinamide/isoniazid Rifampicine/pyrazinamide/isoniazide
nl Rifampicin/isoniazid Rifampicine/isoniazide
nl Rifamycin Rifamycine
nl Rifaximin Rifaximine
@ -307,11 +307,11 @@ nl Rosoxacin Rosoxacine
nl Roxithromycin Roxitromycine
nl Rufloxacin Rufloxacine
nl Sisomicin Sisomicine
nl Sodium aminosalicylate Aminosalicylzuur,4- (na-zout)
nl Sodium aminosalicylate Aminosalicylzuur
nl Sparfloxacin Sparfloxacine
nl Spectinomycin Spectinomycine
nl Spiramycin Spiramycine
nl Spiramycin/metronidazole Spiramycine/andere antibacteriele middelen
nl Spiramycin/metronidazole Spiramycine/metronidazol
nl Staphylococcus immunoglobulin Stafylokokkenimmunoglobuline
nl Streptoduocin Streptoduocine
nl Streptomycin Streptomycine
@ -345,7 +345,6 @@ nl Temocillin Temocilline
nl Tenofovir disoproxil Tenofovir
nl Terizidone Terizidon
nl Thiamphenicol Thiamfenicol
nl Thiamphenicol Thiamfenicol combinatiepreparaten
nl Thioacetazone/isoniazid Thioacetazon/isoniazide
nl Ticarcillin Ticarcilline
nl Ticarcillin/beta-lactamase inhibitor Ticarcilline/enzymremmer
@ -355,3 +354,18 @@ nl Troleandomycin Troleandomycine
nl Trovafloxacin Trovafloxacine
nl Vancomycin Vancomycine
nl Voriconazole Voriconazol
nl Aminoglycosides Aminoglycosiden TRUE FALSE
nl Amphenicols Amfenicolen TRUE FALSE
nl Antifungals/antimycotics Antifungica/antimycotica TRUE FALSE
nl Antimycobacterials Antimycobacteriele middelen TRUE FALSE
nl Beta-lactams/penicillins Beta-lactams/penicillines TRUE FALSE
nl Cephalosporins (1st gen.) Cefalosporines (1e gen.) TRUE FALSE
nl Cephalosporins (2nd gen.) Cefalosporines (2e gen.) TRUE FALSE
nl Cephalosporins (3rd gen.) Cefalosporines (3e gen.) TRUE FALSE
nl Cephalosporins (4th gen.) Cefalosporines (4e gen.) TRUE FALSE
nl Cephalosporins Cefalosporines TRUE FALSE
nl Glycopeptides Glycopeptiden TRUE FALSE
nl Macrolides/lincosamides Macroliden/lincosamiden TRUE FALSE
nl Other antibacterials Overige antibiotica TRUE FALSE
nl Polymyxins Polymyxines TRUE FALSE
nl Quinolones Quinolonen TRUE FALSE

Can't render this file because it has a wrong number of fields in line 157.

View File

@ -23,11 +23,11 @@ ab_synonyms(x, ...)
ab_tradenames(x, ...)
ab_group(x, ...)
ab_group(x, language = get_locale(), ...)
ab_atc_group1(x, ...)
ab_atc_group1(x, language = get_locale(), ...)
ab_atc_group2(x, ...)
ab_atc_group2(x, language = get_locale(), ...)
ab_ddd(x, administration = "oral", units = FALSE, ...)
@ -51,7 +51,7 @@ ab_property(x, property = "name", language = get_locale(), ...)
\value{
\itemize{
\item{An \code{integer} in case of \code{ab_cid}}
\item{A named \code{list} in case of multiple \code{ab_synonyms}}
\item{A named \code{list} in case of \code{ab_info} and multiple \code{ab_synonyms}/\code{ab_tradenames}}
\item{A \code{double} in case of \code{ab_ddd}}
\item{A \code{character} in all other cases}
}
@ -98,6 +98,8 @@ ab_ddd("AMX", "oral", units = TRUE) # "g"
ab_ddd("AMX", "iv") # 1
ab_ddd("AMX", "iv", units = TRUE) # "g"
ab_info("AMX") # all properties as a list
# all ab_* functions use as.ab() internally:
ab_name("Fluclox") # "Flucloxacillin"
ab_name("fluklox") # "Flucloxacillin"

View File

@ -2,9 +2,12 @@
% Please edit documentation in R/ab.R
\name{as.ab}
\alias{as.ab}
\alias{is.ab}
\title{Transform to antibiotic ID}
\usage{
as.ab(x)
is.ab(x)
}
\arguments{
\item{x}{character vector to determine to antibiotic ID}
@ -56,7 +59,7 @@ as.ab("eryt")
as.ab(" eryt 123")
as.ab("ERYT")
as.ab("ERY")
as.ab("erytromicine") # spelled wrong
as.ab("eritromicine") # spelled wrong, yet works
as.ab("Erythrocin") # trade name
as.ab("Romycin") # trade name

View File

@ -1,14 +1,11 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ab.R, R/atc.R
\name{is.ab}
\alias{is.ab}
% Please edit documentation in R/atc.R
\name{as.atc}
\alias{as.atc}
\alias{atc}
\alias{is.atc}
\title{Transform to ATC code}
\usage{
is.ab(x)
as.atc(x)
is.atc(x)
@ -17,7 +14,7 @@ is.atc(x)
\item{x}{character vector to determine \code{ATC} code}
}
\value{
Character (vector) with class \code{"act"}. Unknown values will return \code{NA}.
Character (vector) with class \code{"atc"}. Unknown values will return \code{NA}.
}
\description{
Use this function to determine the ATC code of one or more antibiotics. The data set \code{\link{antibiotics}} will be searched for abbreviations, official names and trade names.

View File

@ -67,6 +67,8 @@ $( document ).ready(function() {
x = x.replace("Alex", "Prof Dr Alex");
x = x.replace("Bhanu", "Prof Dr Bhanu");
x = x.replace(/Author, thesis advisor/g, "Doctoral advisor");
x = x.replace(/Author, maintainer./g, "");
x = x.replace(/Author./g, "");
}
return(x);
}

View File

@ -49,6 +49,8 @@ test_that("ab_property works", {
expect_identical(ab_name(x = c("AMC", "PLB"), tolower = TRUE),
c("amoxicillin/clavulanic acid", "polymyxin B"))
expect_equal(class(ab_info("AMX")), "list")
expect_error(ab_property("amox", "invalid property"))
expect_error(ab_name("amox", language = "INVALID"))
expect_output(print(ab_name("amox", language = NULL)))