(v1.4.0.9041) updates based on review

This commit is contained in:
dr. M.S. (Matthijs) Berends 2020-12-17 16:22:25 +01:00
parent 1faa816090
commit 81af41da3a
74 changed files with 710 additions and 627 deletions

View File

@ -1,6 +1,6 @@
Package: AMR Package: AMR
Version: 1.4.0.9040 Version: 1.4.0.9041
Date: 2020-12-16 Date: 2020-12-17
Title: Antimicrobial Resistance Analysis Title: Antimicrobial Resistance Analysis
Authors@R: c( Authors@R: c(
person(role = c("aut", "cre"), person(role = c("aut", "cre"),
@ -47,6 +47,7 @@ Suggests:
ggplot2, ggplot2,
knitr, knitr,
microbenchmark, microbenchmark,
pillar,
readxl, readxl,
rmarkdown, rmarkdown,
rstudioapi, rstudioapi,
@ -54,6 +55,7 @@ Suggests:
skimr, skimr,
testthat, testthat,
tidyr, tidyr,
tidyselect,
xml2 xml2
VignetteBuilder: knitr,rmarkdown VignetteBuilder: knitr,rmarkdown
URL: https://msberends.github.io/AMR/, https://github.com/msberends/AMR URL: https://msberends.github.io/AMR/, https://github.com/msberends/AMR

11
NEWS.md
View File

@ -1,5 +1,7 @@
# AMR 1.4.0.9040 # AMR 1.4.0.9041
## <small>Last updated: 16 December 2020</small> ## <small>Last updated: 17 December 2020</small>
Note: some changes in this version were suggested by anonymous reviewers from the journal we submitted our manuscript about this package to. We are those reviewers very grateful for going through our code so thoroughly!
### New ### New
* Function `is_new_episode()` to determine patient episodes which are not necessarily based on microorganisms. It also supports grouped variables with e.g. `mutate()`, `filter()` and `summarise()` of the `dplyr` package: * Function `is_new_episode()` to determine patient episodes which are not necessarily based on microorganisms. It also supports grouped variables with e.g. `mutate()`, `filter()` and `summarise()` of the `dplyr` package:
@ -26,6 +28,7 @@
as_tibble() as_tibble()
``` ```
* For all function parameters in the code, it is now defined what the exact type of user input should be (inspired by the [`typed`](https://github.com/moodymudskipper/typed) package). If the user input for a certain function does not meet the requirements for a specific parameter (such as the class or length), an informative error will be thrown. This makes the package more robust and the use of it more reproducible and reliable. In total, more than 400 arguments were defined. * For all function parameters in the code, it is now defined what the exact type of user input should be (inspired by the [`typed`](https://github.com/moodymudskipper/typed) package). If the user input for a certain function does not meet the requirements for a specific parameter (such as the class or length), an informative error will be thrown. This makes the package more robust and the use of it more reproducible and reliable. In total, more than 400 arguments were defined.
* Fix for `set_mo_source()`, that previously would not remember the file location of the original file
* Deprecated function `p_symbol()` that not really fits the scope of this package. It will be removed in a future version. See [here](https://github.com/msberends/AMR/blob/v1.4.0/R/p_symbol.R) for the source code to preserve it. * Deprecated function `p_symbol()` that not really fits the scope of this package. It will be removed in a future version. See [here](https://github.com/msberends/AMR/blob/v1.4.0/R/p_symbol.R) for the source code to preserve it.
* Better determination of disk zones and MIC values when running `as.rsi()` on a data.frame * Better determination of disk zones and MIC values when running `as.rsi()` on a data.frame
* Updated coagulase-negative staphylococci determination with Becker *et al.* 2020 (PMID 32056452), meaning that the species *S. argensis*, *S. caeli*, *S. debuckii*, *S. edaphicus* and *S. pseudoxylosus* are now all considered CoNS * Updated coagulase-negative staphylococci determination with Becker *et al.* 2020 (PMID 32056452), meaning that the species *S. argensis*, *S. caeli*, *S. debuckii*, *S. edaphicus* and *S. pseudoxylosus* are now all considered CoNS
@ -40,14 +43,16 @@
* Fix for plotting MIC values with `plot()` * Fix for plotting MIC values with `plot()`
* Added `plot()` generic to class `<disk>` * Added `plot()` generic to class `<disk>`
* LA-MRSA and CA-MRSA are now recognised as an abbreviation for *Staphylococcus aureus*, meaning that e.g. `mo_genus("LA-MRSA")` will return `"Staphylococcus"` and `mo_is_gram_positive("LA-MRSA")` will return `TRUE`. * LA-MRSA and CA-MRSA are now recognised as an abbreviation for *Staphylococcus aureus*, meaning that e.g. `mo_genus("LA-MRSA")` will return `"Staphylococcus"` and `mo_is_gram_positive("LA-MRSA")` will return `TRUE`.
* Fix for using `as.rsi()` on a `data.frame` that only contains one column for antibiotic interpretations
### Other ### Other
* All messages and warnings thrown by this package now break sentences on whole words * All messages and warnings thrown by this package now break sentences on whole words
* More extensive unit tests * More extensive unit tests
* Internal calls to `options()` were all removed in favour of a new internal environment `mo_env`
# AMR 1.4.0 # AMR 1.4.0
Note: some changes in this version were suggested by anonymous reviewers from the journal we submitted our manuscipt about this package to. We are those reviewers very grateful for going through our code so thoroughly! Note: some changes in this version were suggested by anonymous reviewers from the journal we submitted our manuscript about this package to. We are those reviewers very grateful for going through our code so thoroughly!
### New ### New
* Support for 'EUCAST Expert Rules' / 'EUCAST Intrinsic Resistance and Unusual Phenotypes' version 3.2 of May 2020. With this addition to the previously implemented version 3.1 of 2016, the `eucast_rules()` function can now correct for more than 180 different antibiotics and the `mdro()` function can determine multidrug resistance based on more than 150 different antibiotics. All previously implemented versions of the EUCAST rules are now maintained and kept available in this package. The `eucast_rules()` function consequently gained the parameters `version_breakpoints` (at the moment defaults to v10.0, 2020) and `version_expertrules` (at the moment defaults to v3.2, 2020). The `example_isolates` data set now also reflects the change from v3.1 to v3.2. The `mdro()` function now accepts `guideline == "EUCAST3.1"` and `guideline == "EUCAST3.2"`. * Support for 'EUCAST Expert Rules' / 'EUCAST Intrinsic Resistance and Unusual Phenotypes' version 3.2 of May 2020. With this addition to the previously implemented version 3.1 of 2016, the `eucast_rules()` function can now correct for more than 180 different antibiotics and the `mdro()` function can determine multidrug resistance based on more than 150 different antibiotics. All previously implemented versions of the EUCAST rules are now maintained and kept available in this package. The `eucast_rules()` function consequently gained the parameters `version_breakpoints` (at the moment defaults to v10.0, 2020) and `version_expertrules` (at the moment defaults to v3.2, 2020). The `example_isolates` data set now also reflects the change from v3.1 to v3.2. The `mdro()` function now accepts `guideline == "EUCAST3.1"` and `guideline == "EUCAST3.2"`.

View File

@ -101,6 +101,8 @@ check_dataset_integrity <- function() {
# package not yet loaded # package not yet loaded
require("AMR") require("AMR")
}) })
stop_if(!check_microorganisms | !check_antibiotics,
"the data set `microorganisms` or `antibiotics` was overwritten in your environment because another package with the same object names was loaded _after_ the AMR package, preventing the AMR package from working correctly. Please load the AMR package last.")
invisible(TRUE) invisible(TRUE)
} }
@ -224,10 +226,11 @@ import_fn <- function(name, pkg, error_on_fail = TRUE) {
stop_ifnot_installed(pkg) stop_ifnot_installed(pkg)
} }
tryCatch( tryCatch(
get(name, envir = asNamespace(pkg)), # don't use get() to avoid fetching non-API functions
getExportedValue(name = name, ns = asNamespace(pkg)),
error = function(e) { error = function(e) {
if (isTRUE(error_on_fail)) { if (isTRUE(error_on_fail)) {
stop_("function ", name, "() not found in package '", pkg, stop_("function ", name, "() is not an exported object from package '", pkg,
"'. Please create an issue at https://github.com/msberends/AMR/issues. Many thanks!", "'. Please create an issue at https://github.com/msberends/AMR/issues. Many thanks!",
call = FALSE) call = FALSE)
} else { } else {
@ -239,7 +242,7 @@ import_fn <- function(name, pkg, error_on_fail = TRUE) {
# this alternative wrapper to the message(), warning() and stop() functions: # this alternative wrapper to the message(), warning() and stop() functions:
# - wraps text to never break lines within words # - wraps text to never break lines within words
# - ignores formatted text while wrapping # - ignores formatted text while wrapping
# - adds indentation dependent on the type of message (like NOTE) # - adds indentation dependent on the type of message (such as NOTE)
# - can add additional formatting functions like blue or bold text # - can add additional formatting functions like blue or bold text
word_wrap <- function(..., word_wrap <- function(...,
add_fn = list(), add_fn = list(),
@ -690,6 +693,17 @@ set_clean_class <- function(x, new_class) {
x x
} }
formatted_filesize <- function(...) {
size_kb <- file.size(...) / 1024
if (size_kb < 1) {
paste(round(size_kb, 1), "kB")
} else if (size_kb < 100) {
paste(round(size_kb, 0), "kB")
} else {
paste(round(size_kb / 1024, 1), "MB")
}
}
create_pillar_column <- function(x, ...) { create_pillar_column <- function(x, ...) {
new_pillar_shaft_simple <- import_fn("new_pillar_shaft_simple", "pillar", error_on_fail = FALSE) new_pillar_shaft_simple <- import_fn("new_pillar_shaft_simple", "pillar", error_on_fail = FALSE)
if (!is.null(new_pillar_shaft_simple)) { if (!is.null(new_pillar_shaft_simple)) {
@ -817,7 +831,7 @@ percentage <- function(x, digits = NULL, ...) {
} }
# prevent dependency on package 'backports' # prevent dependency on package 'backports'
# these functions were not available in previous versions of R (last checked: R 4.0.2) # these functions were not available in previous versions of R (last checked: R 4.0.3)
# see here for the full list: https://github.com/r-lib/backports # see here for the full list: https://github.com/r-lib/backports
strrep <- function(x, times) { strrep <- function(x, times) {
x <- as.character(x) x <- as.character(x)
@ -861,3 +875,6 @@ str2lang <- function(s) {
isNamespaceLoaded <- function(pkg) { isNamespaceLoaded <- function(pkg) {
pkg %in% loadedNamespaces() pkg %in% loadedNamespaces()
} }
lengths = function(x, use.names = TRUE) {
vapply(x, length, FUN.VALUE = NA_integer_, USE.NAMES = use.names)
}

View File

@ -388,29 +388,29 @@ pm_group_size <- function(x) {
pm_n_groups <- function(x) { pm_n_groups <- function(x) {
nrow(pm_group_data(x)) nrow(pm_group_data(x))
} }
pm_group_split <- function(.data, ..., .keep = TRUE) { # pm_group_split <- function(.data, ..., .keep = TRUE) {
dots_len <- ...length() > 0L # dots_len <- ...length() > 0L
if (pm_has_groups(.data) && isTRUE(dots_len)) { # if (pm_has_groups(.data) && isTRUE(dots_len)) {
warning("... is ignored in pm_group_split(<grouped_df>), please use pm_group_by(..., .add = TRUE) %pm>% pm_group_split()") # warning("... is ignored in pm_group_split(<grouped_df>), please use pm_group_by(..., .add = TRUE) %pm>% pm_group_split()")
} # }
if (!pm_has_groups(.data) && isTRUE(dots_len)) { # if (!pm_has_groups(.data) && isTRUE(dots_len)) {
.data <- pm_group_by(.data, ...) # .data <- pm_group_by(.data, ...)
} # }
if (!pm_has_groups(.data) && isFALSE(dots_len)) { # if (!pm_has_groups(.data) && isFALSE(dots_len)) {
return(list(.data)) # return(list(.data))
} # }
pm_context$setup(.data) # pm_context$setup(.data)
on.exit(pm_context$clean(), add = TRUE) # on.exit(pm_context$clean(), add = TRUE)
pm_groups <- pm_get_groups(.data) # pm_groups <- pm_get_groups(.data)
attr(pm_context$.data, "pm_groups") <- NULL # attr(pm_context$.data, "pm_groups") <- NULL
res <- pm_split_into_groups(pm_context$.data, pm_groups) # res <- pm_split_into_groups(pm_context$.data, pm_groups)
names(res) <- NULL # names(res) <- NULL
if (isFALSE(.keep)) { # if (isFALSE(.keep)) {
res <- lapply(res, function(x) x[, !colnames(x) %in% pm_groups]) # res <- lapply(res, function(x) x[, !colnames(x) %in% pm_groups])
} # }
any_empty <- unlist(lapply(res, function(x) !(nrow(x) == 0L))) # any_empty <- unlist(lapply(res, function(x) !(nrow(x) == 0L)))
res[any_empty] # res[any_empty]
} # }
pm_group_keys <- function(.data) { pm_group_keys <- function(.data) {
pm_groups <- pm_get_groups(.data) pm_groups <- pm_get_groups(.data)

7
R/ab.R
View File

@ -37,13 +37,14 @@
#' #'
#' All these properties will be searched for the user input. The [as.ab()] can correct for different forms of misspelling: #' All these properties will be searched for the user input. The [as.ab()] can correct for different forms of misspelling:
#' #'
#' * Wrong spelling of drug names (like "tobramicin" or "gentamycin"), which corrects for most audible similarities such as f/ph, x/ks, c/z/s, t/th, etc. #' * Wrong spelling of drug names (such as "tobramicin" or "gentamycin"), which corrects for most audible similarities such as f/ph, x/ks, c/z/s, t/th, etc.
#' * Too few or too many vowels or consonants #' * Too few or too many vowels or consonants
#' * Switching two characters (like "mreopenem", often the case in clinical data, when doctors typed too fast) #' * Switching two characters (such as "mreopenem", often the case in clinical data, when doctors typed too fast)
#' * Digitalised paper records, leaving artefacts like 0/o/O (zero and O's), B/8, n/r, etc. #' * Digitalised paper records, leaving artefacts like 0/o/O (zero and O's), B/8, n/r, etc.
#' #'
#' Use the [ab_property()] functions to get properties based on the returned antibiotic ID, see Examples. #' Use the [`ab_*`][ab_property()] functions to get properties based on the returned antibiotic ID, see Examples.
#' #'
#' Note: the [as.ab()] and [`ab_*`][ab_property()] functions may use very long regular expression to match brand names of antimicrobial agents. This may fail on some systems.
#' @section Source: #' @section Source:
#' World Health Organization (WHO) Collaborating Centre for Drug Statistics Methodology: \url{https://www.whocc.no/atc_ddd_index/} #' World Health Organization (WHO) Collaborating Centre for Drug Statistics Methodology: \url{https://www.whocc.no/atc_ddd_index/}
#' #'

View File

@ -46,7 +46,7 @@
#' Without using `collapse`, this function will return a [list]. This can be convenient to use e.g. inside a `mutate()`):\cr #' Without using `collapse`, this function will return a [list]. This can be convenient to use e.g. inside a `mutate()`):\cr
#' `df %>% mutate(abx = ab_from_text(clinical_text))` #' `df %>% mutate(abx = ab_from_text(clinical_text))`
#' #'
#' The returned AB codes can be transformed to official names, groups, etc. with all [ab_property()] functions like [ab_name()] and [ab_group()], or by using the `translate_ab` parameter. #' The returned AB codes can be transformed to official names, groups, etc. with all [`ab_*`][ab_property()] functions such as [ab_name()] and [ab_group()], or by using the `translate_ab` parameter.
#' #'
#' With using `collapse`, this function will return a [character]:\cr #' With using `collapse`, this function will return a [character]:\cr
#' `df %>% mutate(abx = ab_from_text(clinical_text, collapse = "|"))` #' `df %>% mutate(abx = ab_from_text(clinical_text, collapse = "|"))`

View File

@ -42,8 +42,8 @@
#' - Determining multi-drug resistance (MDR) / multi-drug resistant organisms (MDRO) #' - Determining multi-drug resistance (MDR) / multi-drug resistant organisms (MDRO)
#' - Calculating (empirical) susceptibility of both mono therapy and combination therapies #' - Calculating (empirical) susceptibility of both mono therapy and combination therapies
#' - Predicting future antimicrobial resistance using regression models #' - Predicting future antimicrobial resistance using regression models
#' - Getting properties for any microorganism (like Gram stain, species, genus or family) #' - Getting properties for any microorganism (such as Gram stain, species, genus or family)
#' - Getting properties for any antibiotic (like name, code of EARS-Net/ATC/LOINC/PubChem, defined daily dose or trade name) #' - Getting properties for any antibiotic (such as name, code of EARS-Net/ATC/LOINC/PubChem, defined daily dose or trade name)
#' - Plotting antimicrobial resistance #' - Plotting antimicrobial resistance
#' - Applying EUCAST expert rules #' - Applying EUCAST expert rules
#' - Getting SNOMED codes of a microorganism, or getting properties of a microorganism based on a SNOMED code #' - Getting SNOMED codes of a microorganism, or getting properties of a microorganism based on a SNOMED code

View File

@ -50,8 +50,8 @@ format_included_data_number <- function(data) {
#' @section Included taxa: #' @section Included taxa:
#' Included are: #' Included are:
#' - All `r format_included_data_number(microorganisms[which(microorganisms$kingdom %in% c("Archeae", "Bacteria", "Chromista", "Protozoa")), ])` (sub)species from the kingdoms of Archaea, Bacteria, Chromista and Protozoa #' - All `r format_included_data_number(microorganisms[which(microorganisms$kingdom %in% c("Archeae", "Bacteria", "Chromista", "Protozoa")), ])` (sub)species from the kingdoms of Archaea, Bacteria, Chromista and Protozoa
#' - All `r format_included_data_number(microorganisms[which(microorganisms$kingdom == "Fungi" & microorganisms$order %in% c("Eurotiales", "Microascales", "Mucorales", "Onygenales", "Pneumocystales", "Saccharomycetales", "Schizosaccharomycetales", "Tremellales")), ])` (sub)species from these orders of the kingdom of Fungi: Eurotiales, Microascales, Mucorales, Onygenales, Pneumocystales, Saccharomycetales, Schizosaccharomycetales and Tremellales, as well as `r format_included_data_number(microorganisms[which(microorganisms$kingdom == "Fungi" & !microorganisms$order %in% c("Eurotiales", "Microascales", "Mucorales", "Onygenales", "Pneumocystales", "Saccharomycetales", "Schizosaccharomycetales", "Tremellales")), ])` other fungal (sub)species. The kingdom of Fungi is a very large taxon with almost 300,000 different (sub)species, of which most are not microbial (but rather macroscopic, like mushrooms). Because of this, not all fungi fit the scope of this package and including everything would tremendously slow down our algorithms too. By only including the aforementioned taxonomic orders, the most relevant fungi are covered (like all species of *Aspergillus*, *Candida*, *Cryptococcus*, *Histplasma*, *Pneumocystis*, *Saccharomyces* and *Trichophyton*). #' - All `r format_included_data_number(microorganisms[which(microorganisms$kingdom == "Fungi" & microorganisms$order %in% c("Eurotiales", "Microascales", "Mucorales", "Onygenales", "Pneumocystales", "Saccharomycetales", "Schizosaccharomycetales", "Tremellales")), ])` (sub)species from these orders of the kingdom of Fungi: Eurotiales, Microascales, Mucorales, Onygenales, Pneumocystales, Saccharomycetales, Schizosaccharomycetales and Tremellales, as well as `r format_included_data_number(microorganisms[which(microorganisms$kingdom == "Fungi" & !microorganisms$order %in% c("Eurotiales", "Microascales", "Mucorales", "Onygenales", "Pneumocystales", "Saccharomycetales", "Schizosaccharomycetales", "Tremellales")), ])` other fungal (sub)species. The kingdom of Fungi is a very large taxon with almost 300,000 different (sub)species, of which most are not microbial (but rather macroscopic, like mushrooms). Because of this, not all fungi fit the scope of this package and including everything would tremendously slow down our algorithms too. By only including the aforementioned taxonomic orders, the most relevant fungi are covered (such as all species of *Aspergillus*, *Candida*, *Cryptococcus*, *Histplasma*, *Pneumocystis*, *Saccharomyces* and *Trichophyton*).
#' - All `r format_included_data_number(microorganisms[which(microorganisms$kingdom == "Animalia"), ])` (sub)species from `r format_included_data_number(microorganisms[which(microorganisms$kingdom == "Animalia"), "genus"])` other relevant genera from the kingdom of Animalia (like *Strongyloides* and *Taenia*) #' - All `r format_included_data_number(microorganisms[which(microorganisms$kingdom == "Animalia"), ])` (sub)species from `r format_included_data_number(microorganisms[which(microorganisms$kingdom == "Animalia"), "genus"])` other relevant genera from the kingdom of Animalia (such as *Strongyloides* and *Taenia*)
#' - All `r format_included_data_number(microorganisms.old)` previously accepted names of all included (sub)species (these were taxonomically renamed) #' - All `r format_included_data_number(microorganisms.old)` previously accepted names of all included (sub)species (these were taxonomically renamed)
#' - The complete taxonomic tree of all included (sub)species: from kingdom to subspecies #' - The complete taxonomic tree of all included (sub)species: from kingdom to subspecies
#' - The responsible author(s) and year of scientific publication #' - The responsible author(s) and year of scientific publication

View File

@ -25,10 +25,10 @@
#' Data sets with `r format(nrow(antibiotics) + nrow(antivirals), big.mark = ",")` antimicrobials #' Data sets with `r format(nrow(antibiotics) + nrow(antivirals), big.mark = ",")` antimicrobials
#' #'
#' Two data sets containing all antibiotics/antimycotics and antivirals. Use [as.ab()] or one of the [ab_property()] functions to retrieve values from the [antibiotics] data set. Three identifiers are included in this data set: an antibiotic ID (`ab`, primarily used in this package) as defined by WHONET/EARS-Net, an ATC code (`atc`) as defined by the WHO, and a Compound ID (`cid`) as found in PubChem. Other properties in this data set are derived from one or more of these codes. #' Two data sets containing all antibiotics/antimycotics and antivirals. Use [as.ab()] or one of the [`ab_*`][ab_property()] functions to retrieve values from the [antibiotics] data set. Three identifiers are included in this data set: an antibiotic ID (`ab`, primarily used in this package) as defined by WHONET/EARS-Net, an ATC code (`atc`) as defined by the WHO, and a Compound ID (`cid`) as found in PubChem. Other properties in this data set are derived from one or more of these codes.
#' @format #' @format
#' ### For the [antibiotics] data set: a [data.frame] with `r nrow(antibiotics)` observations and `r ncol(antibiotics)` variables: #' ### For the [antibiotics] data set: a [data.frame] with `r nrow(antibiotics)` observations and `r ncol(antibiotics)` variables:
#' - `ab`\cr Antibiotic ID as used in this package (like `AMC`), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available #' - `ab`\cr Antibiotic ID as used in this package (such as `AMC`), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available
#' - `atc`\cr ATC code (Anatomical Therapeutic Chemical) as defined by the WHOCC, like `J01CR02` #' - `atc`\cr ATC code (Anatomical Therapeutic Chemical) as defined by the WHOCC, like `J01CR02`
#' - `cid`\cr Compound ID as found in PubChem #' - `cid`\cr Compound ID as found in PubChem
#' - `name`\cr Official name as used by WHONET/EARS-Net or the WHO #' - `name`\cr Official name as used by WHONET/EARS-Net or the WHO

View File

@ -114,8 +114,9 @@ all_valid_disks <- function(x) {
if (!inherits(x, c("disk", "character", "numeric", "integer"))) { if (!inherits(x, c("disk", "character", "numeric", "integer"))) {
return(FALSE) return(FALSE)
} }
x_disk <- suppressWarnings(as.disk(x[!is.na(x)])) x_disk <- tryCatch(suppressWarnings(as.disk(x[!is.na(x)])),
!any(is.na(x_disk)) & !all(is.na(x)) error = function(e) NA)
!any(is.na(x_disk)) && !all(is.na(x))
} }
#' @rdname as.disk #' @rdname as.disk
@ -223,14 +224,12 @@ unique.disk <- function(x, incomparables = FALSE, ...) {
# will be exported using s3_register() in R/zzz.R # will be exported using s3_register() in R/zzz.R
get_skimmers.disk <- function(column) { get_skimmers.disk <- function(column) {
sfl <- import_fn("sfl", "skimr", error_on_fail = FALSE) skimr::sfl(
inline_hist <- import_fn("inline_hist", "skimr", error_on_fail = FALSE)
sfl(
skim_type = "disk", skim_type = "disk",
min = ~min(as.double(.), na.rm = TRUE), min = ~min(as.double(.), na.rm = TRUE),
max = ~max(as.double(.), na.rm = TRUE), max = ~max(as.double(.), na.rm = TRUE),
median = ~stats::median(as.double(.), na.rm = TRUE), median = ~stats::median(as.double(.), na.rm = TRUE),
n_unique = ~pm_n_distinct(., na.rm = TRUE), n_unique = ~pm_n_distinct(., na.rm = TRUE),
hist = ~inline_hist(stats::na.omit(as.double(.))) hist = ~skimr::inline_hist(stats::na.omit(as.double(.)))
) )
} }

View File

@ -31,7 +31,7 @@
#' @param col_date column name of the result date (or date that is was received on the lab), defaults to the first column with a date class #' @param col_date column name of the result date (or date that is was received on the lab), defaults to the first column with a date class
#' @param col_patient_id column name of the unique IDs of the patients, defaults to the first column that starts with 'patient' or 'patid' (case insensitive) #' @param col_patient_id column name of the unique IDs of the patients, defaults to the first column that starts with 'patient' or 'patid' (case insensitive)
#' @param col_mo column name of the IDs of the microorganisms (see [as.mo()]), defaults to the first column of class [`mo`]. Values will be coerced using [as.mo()]. #' @param col_mo column name of the IDs of the microorganisms (see [as.mo()]), defaults to the first column of class [`mo`]. Values will be coerced using [as.mo()].
#' @param col_testcode column name of the test codes. Use `col_testcode = NULL` to **not** exclude certain test codes (like test codes for screening). In that case `testcodes_exclude` will be ignored. #' @param col_testcode column name of the test codes. Use `col_testcode = NULL` to **not** exclude certain test codes (such as test codes for screening). In that case `testcodes_exclude` will be ignored.
#' @param col_specimen column name of the specimen type or group #' @param col_specimen column name of the specimen type or group
#' @param col_icu column name of the logicals (`TRUE`/`FALSE`) whether a ward or department is an Intensive Care Unit (ICU) #' @param col_icu column name of the logicals (`TRUE`/`FALSE`) whether a ward or department is an Intensive Care Unit (ICU)
#' @param col_keyantibiotics column name of the key antibiotics to determine first *weighted* isolates, see [key_antibiotics()]. Defaults to the first column that starts with 'key' followed by 'ab' or 'antibiotics' (case insensitive). Use `col_keyantibiotics = FALSE` to prevent this. #' @param col_keyantibiotics column name of the key antibiotics to determine first *weighted* isolates, see [key_antibiotics()]. Defaults to the first column that starts with 'key' followed by 'ab' or 'antibiotics' (case insensitive). Use `col_keyantibiotics = FALSE` to prevent this.

View File

@ -34,7 +34,7 @@
#' #'
#' The p-value is computed from the asymptotic chi-squared distribution of the test statistic. #' The p-value is computed from the asymptotic chi-squared distribution of the test statistic.
#' #'
#' In the contingency table case simulation is done by random sampling from the set of all contingency tables with given marginals, and works only if the marginals are strictly positive. Note that this is not the usual sampling situation assumed for a chi-squared test (like the *G*-test) but rather that for Fisher's exact test. #' In the contingency table case simulation is done by random sampling from the set of all contingency tables with given marginals, and works only if the marginals are strictly positive. Note that this is not the usual sampling situation assumed for a chi-squared test (such as the *G*-test) but rather that for Fisher's exact test.
#' #'
#' In the goodness-of-fit case simulation is done by random sampling from the discrete distribution specified by `p`, each sample being of size `n = sum(x)`. This simulation is done in \R and may be slow. #' In the goodness-of-fit case simulation is done by random sampling from the discrete distribution specified by `p`, each sample being of size `n = sum(x)`. This simulation is done in \R and may be slow.
#' #'
@ -144,7 +144,7 @@ g.test <- function(x,
DNAME <- paste(paste(DNAME, collapse = "\n"), "and", DNAME <- paste(paste(DNAME, collapse = "\n"), "and",
paste(DNAME2, collapse = "\n")) paste(DNAME2, collapse = "\n"))
} }
if (any(x < 0) || anyNA(x)) if (any(x < 0) || any(is.na((x)))) # this last one was anyNA, but only introduced in R 3.1.0
stop("all entries of 'x' must be nonnegative and finite") stop("all entries of 'x' must be nonnegative and finite")
if ((n <- sum(x)) == 0) if ((n <- sum(x)) == 0)
stop("at least one entry of 'x' must be positive") stop("at least one entry of 'x' must be positive")

View File

@ -23,8 +23,7 @@
# how to conduct AMR analysis: https://msberends.github.io/AMR/ # # how to conduct AMR analysis: https://msberends.github.io/AMR/ #
# ==================================================================== # # ==================================================================== #
globalVariables(c("...length", # for pm_group_split() on R 3.3 globalVariables(c(".rowid",
".rowid",
"ab", "ab",
"ab_txt", "ab_txt",
"angle", "angle",

View File

@ -31,7 +31,7 @@
#' @name join #' @name join
#' @aliases join inner_join #' @aliases join inner_join
#' @param x existing table to join, or character vector #' @param x existing table to join, or character vector
#' @param by a variable to join by - if left empty will search for a column with class [`mo`] (created with [as.mo()]) or will be `"mo"` if that column name exists in `x`, could otherwise be a column name of `x` with values that exist in `microorganisms$mo` (like `by = "bacteria_id"`), or another column in [microorganisms] (but then it should be named, like `by = c("bacteria_id" = "fullname")`) #' @param by a variable to join by - if left empty will search for a column with class [`mo`] (created with [as.mo()]) or will be `"mo"` if that column name exists in `x`, could otherwise be a column name of `x` with values that exist in `microorganisms$mo` (such as `by = "bacteria_id"`), or another column in [microorganisms] (but then it should be named, like `by = c("bacteria_id" = "fullname")`)
#' @param suffix if there are non-joined duplicate variables in `x` and `y`, these suffixes will be added to the output to disambiguate them. Should be a character vector of length 2. #' @param suffix if there are non-joined duplicate variables in `x` and `y`, these suffixes will be added to the output to disambiguate them. Should be a character vector of length 2.
#' @param ... ignored #' @param ... ignored
#' @details **Note:** As opposed to the `join()` functions of `dplyr`, [character] vectors are supported and at default existing columns will get a suffix `"2"` and the newly joined columns will not get a suffix. #' @details **Note:** As opposed to the `join()` functions of `dplyr`, [character] vectors are supported and at default existing columns will get a suffix `"2"` and the newly joined columns will not get a suffix.

10
R/mic.R
View File

@ -142,7 +142,7 @@ all_valid_mics <- function(x) {
} }
x_mic <- tryCatch(suppressWarnings(as.mic(x[!is.na(x)])), x_mic <- tryCatch(suppressWarnings(as.mic(x[!is.na(x)])),
error = function(e) NA) error = function(e) NA)
!any(is.na(x_mic)) & !all(is.na(x)) !any(is.na(x_mic)) && !all(is.na(x))
} }
#' @rdname as.mic #' @rdname as.mic
@ -175,7 +175,7 @@ as.numeric.mic <- function(x, ...) {
#' @method droplevels mic #' @method droplevels mic
#' @export #' @export
#' @noRd #' @noRd
droplevels.mic <- function(x, exclude = ifelse(anyNA(levels(x)), NULL, NA), ...) { droplevels.mic <- function(x, exclude = if (any(is.na(levels(x)))) NULL else NA, ...) {
x <- droplevels.factor(x, exclude = exclude, ...) x <- droplevels.factor(x, exclude = exclude, ...)
class(x) <- c("mic", "ordered", "factor") class(x) <- c("mic", "ordered", "factor")
x x
@ -323,14 +323,12 @@ unique.mic <- function(x, incomparables = FALSE, ...) {
# will be exported using s3_register() in R/zzz.R # will be exported using s3_register() in R/zzz.R
get_skimmers.mic <- function(column) { get_skimmers.mic <- function(column) {
sfl <- import_fn("sfl", "skimr", error_on_fail = FALSE) skimr::sfl(
inline_hist <- import_fn("inline_hist", "skimr", error_on_fail = FALSE)
sfl(
skim_type = "mic", skim_type = "mic",
min = ~as.character(sort(stats::na.omit(.))[1]), min = ~as.character(sort(stats::na.omit(.))[1]),
max = ~as.character(sort(stats::na.omit(.))[length(stats::na.omit(.))]), max = ~as.character(sort(stats::na.omit(.))[length(stats::na.omit(.))]),
median = ~as.character(stats::na.omit(.)[as.double(stats::na.omit(.)) == median(as.double(stats::na.omit(.)))])[1], median = ~as.character(stats::na.omit(.)[as.double(stats::na.omit(.)) == median(as.double(stats::na.omit(.)))])[1],
n_unique = ~pm_n_distinct(., na.rm = TRUE), n_unique = ~pm_n_distinct(., na.rm = TRUE),
hist_log2 = ~inline_hist(log2(as.double(stats::na.omit(.)))) hist_log2 = ~skimr::inline_hist(log2(as.double(stats::na.omit(.))))
) )
} }

107
R/mo.R
View File

@ -25,7 +25,7 @@
#' Transform input to a microorganism ID #' Transform input to a microorganism ID
#' #'
#' Use this function to determine a valid microorganism ID ([`mo`]). Determination is done using intelligent rules and the complete taxonomic kingdoms Bacteria, Chromista, Protozoa, Archaea and most microbial species from the kingdom Fungi (see Source). The input can be almost anything: a full name (like `"Staphylococcus aureus"`), an abbreviated name (like `"S. aureus"`), an abbreviation known in the field (like `"MRSA"`), or just a genus. Please see *Examples*. #' Use this function to determine a valid microorganism ID ([`mo`]). Determination is done using intelligent rules and the complete taxonomic kingdoms Bacteria, Chromista, Protozoa, Archaea and most microbial species from the kingdom Fungi (see Source). The input can be almost anything: a full name (like `"Staphylococcus aureus"`), an abbreviated name (such as `"S. aureus"`), an abbreviation known in the field (such as `"MRSA"`), or just a genus. Please see *Examples*.
#' @inheritSection lifecycle Stable lifecycle #' @inheritSection lifecycle Stable lifecycle
#' @param x a character vector or a [data.frame] with one or two columns #' @param x a character vector or a [data.frame] with one or two columns
#' @param Becker a logical to indicate whether staphylococci should be categorised into coagulase-negative staphylococci ("CoNS") and coagulase-positive staphylococci ("CoPS") instead of their own species, according to Karsten Becker *et al.* (1,2,3). #' @param Becker a logical to indicate whether staphylococci should be categorised into coagulase-negative staphylococci ("CoNS") and coagulase-positive staphylococci ("CoPS") instead of their own species, according to Karsten Becker *et al.* (1,2,3).
@ -111,7 +111,7 @@
#' @return A [character] [vector] with additional class [`mo`] #' @return A [character] [vector] with additional class [`mo`]
#' @seealso [microorganisms] for the [data.frame] that is being used to determine ID's. #' @seealso [microorganisms] for the [data.frame] that is being used to determine ID's.
#' #'
#' The [mo_property()] functions (like [mo_genus()], [mo_gramstain()]) to get properties based on the returned code. #' The [`mo_*`][mo_property()] functions (such as [mo_genus()], [mo_gramstain()]) to get properties based on the returned code.
#' @inheritSection AMR Reference data publicly available #' @inheritSection AMR Reference data publicly available
#' @inheritSection AMR Read more on our website! #' @inheritSection AMR Read more on our website!
#' @examples #' @examples
@ -199,10 +199,10 @@ as.mo <- function(x,
x[trimws2(x) %like% paste0("^(", translate_AMR("no|not", language = language), ") [a-z]+")] <- "UNKNOWN" x[trimws2(x) %like% paste0("^(", translate_AMR("no|not", language = language), ") [a-z]+")] <- "UNKNOWN"
uncertainty_level <- translate_allow_uncertain(allow_uncertain) uncertainty_level <- translate_allow_uncertain(allow_uncertain)
if (mo_source_isvalid(reference_df) if (!is.null(reference_df)
&& mo_source_isvalid(reference_df)
&& isFALSE(Becker) && isFALSE(Becker)
&& isFALSE(Lancefield) && isFALSE(Lancefield)
&& !is.null(reference_df)
&& all(x %in% unlist(reference_df), na.rm = TRUE)) { && all(x %in% unlist(reference_df), na.rm = TRUE)) {
reference_df <- repair_reference_df(reference_df) reference_df <- repair_reference_df(reference_df)
@ -358,11 +358,11 @@ exec_as.mo <- function(x,
x[trimws2(x) %like% paste0("^(", translate_AMR("no|not", language = language), ") [a-z]+")] <- "UNKNOWN" x[trimws2(x) %like% paste0("^(", translate_AMR("no|not", language = language), ") [a-z]+")] <- "UNKNOWN"
if (initial_search == TRUE) { if (initial_search == TRUE) {
options(mo_failures = NULL) mo_env$mo_failures <- NULL
options(mo_uncertainties = NULL) mo_env$mo_uncertainties <- NULL
options(mo_renamed = NULL) mo_env$mo_renamed <- NULL
} }
options(mo_renamed_last_run = NULL) mo_env$mo_renamed_last_run <- NULL
failures <- character(0) failures <- character(0)
uncertainty_level <- translate_allow_uncertain(allow_uncertain) uncertainty_level <- translate_allow_uncertain(allow_uncertain)
@ -595,7 +595,7 @@ exec_as.mo <- function(x,
} else { } else {
x[i] <- lookup(fullname == found["fullname_new"], haystack = MO_lookup) x[i] <- lookup(fullname == found["fullname_new"], haystack = MO_lookup)
} }
options(mo_renamed_last_run = found["fullname"]) mo_env$mo_renamed_last_run <- found["fullname"]
was_renamed(name_old = found["fullname"], was_renamed(name_old = found["fullname"],
name_new = lookup(fullname == found["fullname_new"], "fullname", haystack = MO_lookup), name_new = lookup(fullname == found["fullname_new"], "fullname", haystack = MO_lookup),
ref_old = found["ref"], ref_old = found["ref"],
@ -970,7 +970,7 @@ exec_as.mo <- function(x,
} else { } else {
x[i] <- lookup(fullname == found["fullname_new"], haystack = MO_lookup) x[i] <- lookup(fullname == found["fullname_new"], haystack = MO_lookup)
} }
options(mo_renamed_last_run = found["fullname"]) mo_env$mo_renamed_last_run <- found["fullname"]
was_renamed(name_old = found["fullname"], was_renamed(name_old = found["fullname"],
name_new = lookup(fullname == found["fullname_new"], "fullname", haystack = MO_lookup), name_new = lookup(fullname == found["fullname_new"], "fullname", haystack = MO_lookup),
ref_old = found["ref"], ref_old = found["ref"],
@ -1022,7 +1022,7 @@ exec_as.mo <- function(x,
ref_old = found["ref"], ref_old = found["ref"],
ref_new = lookup(fullname == found["fullname_new"], "ref", haystack = MO_lookup), ref_new = lookup(fullname == found["fullname_new"], "ref", haystack = MO_lookup),
mo = lookup(fullname == found["fullname_new"], "mo", haystack = MO_lookup)) mo = lookup(fullname == found["fullname_new"], "mo", haystack = MO_lookup))
options(mo_renamed_last_run = found["fullname"]) mo_env$mo_renamed_last_run <- found["fullname"]
uncertainties <<- rbind(uncertainties, uncertainties <<- rbind(uncertainties,
format_uncertainty_as_df(uncertainty_level = now_checks_for_uncertainty_level, format_uncertainty_as_df(uncertainty_level = now_checks_for_uncertainty_level,
input = a.x_backup, input = a.x_backup,
@ -1393,7 +1393,7 @@ exec_as.mo <- function(x,
# handling failures ---- # handling failures ----
failures <- failures[!failures %in% c(NA, NULL, NaN)] failures <- failures[!failures %in% c(NA, NULL, NaN)]
if (length(failures) > 0 & initial_search == TRUE) { if (length(failures) > 0 & initial_search == TRUE) {
options(mo_failures = sort(unique(failures))) mo_env$mo_failures <- sort(unique(failures))
plural <- c("value", "it", "was") plural <- c("value", "it", "was")
if (pm_n_distinct(failures) > 1) { if (pm_n_distinct(failures) > 1) {
plural <- c("values", "them", "were") plural <- c("values", "them", "were")
@ -1420,7 +1420,7 @@ exec_as.mo <- function(x,
# handling uncertainties ---- # handling uncertainties ----
if (NROW(uncertainties) > 0 & initial_search == TRUE) { if (NROW(uncertainties) > 0 & initial_search == TRUE) {
uncertainties <- as.list(pm_distinct(uncertainties, input, .keep_all = TRUE)) uncertainties <- as.list(pm_distinct(uncertainties, input, .keep_all = TRUE))
options(mo_uncertainties = uncertainties) mo_env$mo_uncertainties <- uncertainties
plural <- c("", "it", "was") plural <- c("", "it", "was")
if (length(uncertainties$input) > 1) { if (length(uncertainties$input) > 1) {
@ -1540,13 +1540,13 @@ was_renamed <- function(name_old, name_new, ref_old = "", ref_new = "", mo = "")
new_ref = ref_new, new_ref = ref_new,
mo = mo, mo = mo,
stringsAsFactors = FALSE) stringsAsFactors = FALSE)
already_set <- getOption("mo_renamed") already_set <- mo_env$mo_renamed
if (!is.null(already_set)) { if (!is.null(already_set)) {
options(mo_renamed = rbind(already_set, mo_env$mo_renamed = rbind(already_set,
newly_set, newly_set,
stringsAsFactors = FALSE)) stringsAsFactors = FALSE)
} else { } else {
options(mo_renamed = newly_set) mo_env$mo_renamed <- newly_set
} }
} }
@ -1554,9 +1554,9 @@ format_uncertainty_as_df <- function(uncertainty_level,
input, input,
result_mo, result_mo,
candidates = NULL) { candidates = NULL) {
if (!is.null(getOption("mo_renamed_last_run", default = NULL))) { if (!is.null(mo_env$mo_renamed_last_run)) {
fullname <- getOption("mo_renamed_last_run") fullname <- mo_env$mo_renamed_last_run
options(mo_renamed_last_run = NULL) mo_env$mo_renamed_last_run <- NULL
renamed_to <- MO_lookup[match(result_mo, MO_lookup$mo), "fullname", drop = TRUE][1] renamed_to <- MO_lookup[match(result_mo, MO_lookup$mo), "fullname", drop = TRUE][1]
} else { } else {
fullname <- MO_lookup[match(result_mo, MO_lookup$mo), "fullname", drop = TRUE][1] fullname <- MO_lookup[match(result_mo, MO_lookup$mo), "fullname", drop = TRUE][1]
@ -1603,27 +1603,32 @@ freq.mo <- function(x, ...) {
if (is.null(digits)) { if (is.null(digits)) {
digits <- 2 digits <- 2
} }
freq.default <- import_fn("freq.default", "cleaner", error_on_fail = FALSE) cleaner::freq.default(
freq.default(x = x, ..., x = x,
.add_header = list(`Gram-negative` = paste0(format(sum(grams == "Gram-negative", na.rm = TRUE), ...,
big.mark = ",", .add_header = list(
decimal.mark = "."), `Gram-negative` = paste0(
" (", percentage(sum(grams == "Gram-negative", na.rm = TRUE) / length(grams), digits = digits), format(sum(grams == "Gram-negative", na.rm = TRUE),
")"), big.mark = ",",
`Gram-positive` = paste0(format(sum(grams == "Gram-positive", na.rm = TRUE), decimal.mark = "."),
big.mark = ",", " (", percentage(sum(grams == "Gram-negative", na.rm = TRUE) / length(grams),
decimal.mark = "."), digits = digits),
" (", percentage(sum(grams == "Gram-positive", na.rm = TRUE) / length(grams), digits = digits), ")"),
")"), `Gram-positive` = paste0(
`Nr. of genera` = pm_n_distinct(mo_genus(x_noNA, language = NULL)), format(sum(grams == "Gram-positive", na.rm = TRUE),
`Nr. of species` = pm_n_distinct(paste(mo_genus(x_noNA, language = NULL), big.mark = ",",
mo_species(x_noNA, language = NULL))))) decimal.mark = "."),
" (", percentage(sum(grams == "Gram-positive", na.rm = TRUE) / length(grams),
digits = digits),
")"),
`Nr. of genera` = pm_n_distinct(mo_genus(x_noNA, language = NULL)),
`Nr. of species` = pm_n_distinct(paste(mo_genus(x_noNA, language = NULL),
mo_species(x_noNA, language = NULL)))))
} }
# will be exported using s3_register() in R/zzz.R # will be exported using s3_register() in R/zzz.R
get_skimmers.mo <- function(column) { get_skimmers.mo <- function(column) {
sfl <- import_fn("sfl", "skimr", error_on_fail = FALSE) skimr::sfl(
sfl(
skim_type = "mo", skim_type = "mo",
unique_total = ~pm_n_distinct(., na.rm = TRUE), unique_total = ~pm_n_distinct(., na.rm = TRUE),
gram_negative = ~sum(mo_is_gram_negative(stats::na.omit(.))), gram_negative = ~sum(mo_is_gram_negative(stats::na.omit(.))),
@ -1736,16 +1741,16 @@ unique.mo <- function(x, incomparables = FALSE, ...) {
#' @rdname as.mo #' @rdname as.mo
#' @export #' @export
mo_failures <- function() { mo_failures <- function() {
getOption("mo_failures") mo_env$mo_failures
} }
#' @rdname as.mo #' @rdname as.mo
#' @export #' @export
mo_uncertainties <- function() { mo_uncertainties <- function() {
if (is.null(getOption("mo_uncertainties"))) { if (is.null(mo_env$mo_uncertainties)) {
return(NULL) return(NULL)
} }
set_clean_class(as.data.frame(getOption("mo_uncertainties"), set_clean_class(as.data.frame(mo_env$mo_uncertainties,
stringsAsFactors = FALSE), stringsAsFactors = FALSE),
new_class = c("mo_uncertainties", "data.frame")) new_class = c("mo_uncertainties", "data.frame"))
} }
@ -1814,7 +1819,7 @@ print.mo_uncertainties <- function(x, ...) {
#' @rdname as.mo #' @rdname as.mo
#' @export #' @export
mo_renamed <- function() { mo_renamed <- function() {
items <- getOption("mo_renamed", default = NULL) items <- mo_env$mo_renamed
if (is.null(items)) { if (is.null(items)) {
items <- data.frame(stringsAsFactors = FALSE) items <- data.frame(stringsAsFactors = FALSE)
} else { } else {
@ -1878,20 +1883,20 @@ translate_allow_uncertain <- function(allow_uncertain) {
} }
get_mo_failures_uncertainties_renamed <- function() { get_mo_failures_uncertainties_renamed <- function() {
remember <- list(failures = getOption("mo_failures"), remember <- list(failures = mo_env$mo_failures,
uncertainties = getOption("mo_uncertainties"), uncertainties = mo_env$mo_uncertainties,
renamed = getOption("mo_renamed")) renamed = mo_env$mo_renamed)
# empty them, otherwise mo_shortname("Chlamydophila psittaci") will give 3 notes # empty them, otherwise mo_shortname("Chlamydophila psittaci") will give 3 notes
options("mo_failures" = NULL) mo_env$mo_failures <- NULL
options("mo_uncertainties" = NULL) mo_env$mo_uncertainties <- NULL
options("mo_renamed" = NULL) mo_env$mo_renamed <- NULL
remember remember
} }
load_mo_failures_uncertainties_renamed <- function(metadata) { load_mo_failures_uncertainties_renamed <- function(metadata) {
options("mo_failures" = metadata$failures) mo_env$mo_failures <- metadata$failures
options("mo_uncertainties" = metadata$uncertainties) mo_env$mo_uncertainties <- metadata$uncertainties
options("mo_renamed" = metadata$renamed) mo_env$mo_renamed <- metadata$renamed
} }
trimws2 <- function(x) { trimws2 <- function(x) {
@ -1978,3 +1983,5 @@ repair_reference_df <- function(reference_df) {
reference_df[, "mo"] <- as.mo(reference_df[, "mo", drop = TRUE]) reference_df[, "mo"] <- as.mo(reference_df[, "mo", drop = TRUE])
reference_df reference_df
} }
mo_env <- new.env(hash = FALSE)

View File

@ -38,7 +38,7 @@
#' - `mo_ref("Escherichia blattae")` will return `"Burgess et al., 1973"` (with a message about the renaming) #' - `mo_ref("Escherichia blattae")` will return `"Burgess et al., 1973"` (with a message about the renaming)
#' - `mo_ref("Shimwellia blattae")` will return `"Priest et al., 2010"` (without a message) #' - `mo_ref("Shimwellia blattae")` will return `"Priest et al., 2010"` (without a message)
#' #'
#' The short name - [mo_shortname()] - almost always returns the first character of the genus and the full species, like `"E. coli"`. Exceptions are abbreviations of staphylococci (like *"CoNS"*, Coagulase-Negative Staphylococci) and beta-haemolytic streptococci (like *"GBS"*, Group B Streptococci). Please bear in mind that e.g. *E. coli* could mean *Escherichia coli* (kingdom of Bacteria) as well as *Entamoeba coli* (kingdom of Protozoa). Returning to the full name will be done using [as.mo()] internally, giving priority to bacteria and human pathogens, i.e. `"E. coli"` will be considered *Escherichia coli*. In other words, `mo_fullname(mo_shortname("Entamoeba coli"))` returns `"Escherichia coli"`. #' The short name - [mo_shortname()] - almost always returns the first character of the genus and the full species, like `"E. coli"`. Exceptions are abbreviations of staphylococci (such as *"CoNS"*, Coagulase-Negative Staphylococci) and beta-haemolytic streptococci (such as *"GBS"*, Group B Streptococci). Please bear in mind that e.g. *E. coli* could mean *Escherichia coli* (kingdom of Bacteria) as well as *Entamoeba coli* (kingdom of Protozoa). Returning to the full name will be done using [as.mo()] internally, giving priority to bacteria and human pathogens, i.e. `"E. coli"` will be considered *Escherichia coli*. In other words, `mo_fullname(mo_shortname("Entamoeba coli"))` returns `"Escherichia coli"`.
#' #'
#' Since the top-level of the taxonomy is sometimes referred to as 'kingdom' and sometimes as 'domain', the functions [mo_kingdom()] and [mo_domain()] return the exact same results. #' Since the top-level of the taxonomy is sometimes referred to as 'kingdom' and sometimes as 'domain', the functions [mo_kingdom()] and [mo_domain()] return the exact same results.
#' #'

View File

@ -30,16 +30,17 @@
#' This is **the fastest way** to have your organisation (or analysis) specific codes picked up and translated by this package. #' This is **the fastest way** to have your organisation (or analysis) specific codes picked up and translated by this package.
#' @inheritSection lifecycle Stable lifecycle #' @inheritSection lifecycle Stable lifecycle
#' @param path location of your reference file, see Details. Can be `""`, `NULL` or `FALSE` to delete the reference file. #' @param path location of your reference file, see Details. Can be `""`, `NULL` or `FALSE` to delete the reference file.
#' @param destination destination of the compressed data file, default to the user's home directory.
#' @rdname mo_source #' @rdname mo_source
#' @name mo_source #' @name mo_source
#' @aliases set_mo_source get_mo_source #' @aliases set_mo_source get_mo_source
#' @details The reference file can be a text file separated with commas (CSV) or tabs or pipes, an Excel file (either 'xls' or 'xlsx' format) or an R object file (extension '.rds'). To use an Excel file, you will need to have the `readxl` package installed. #' @details The reference file can be a text file separated with commas (CSV) or tabs or pipes, an Excel file (either 'xls' or 'xlsx' format) or an R object file (extension '.rds'). To use an Excel file, you will need to have the `readxl` package installed.
#' #'
#' [set_mo_source()] will check the file for validity: it must be a [data.frame], must have a column named `"mo"` which contains values from [`microorganisms$mo`][microorganisms] and must have a reference column with your own defined values. If all tests pass, [set_mo_source()] will read the file into R and will ask to export it to `"~/.mo_source.rds"`. The CRAN policy disallows packages to write to the file system, although '*exceptions may be allowed in interactive sessions if the package obtains confirmation from the user*'. For this reason, this function only works in interactive sessions so that the user can **specifically confirm and allow** that this file will be created. #' [set_mo_source()] will check the file for validity: it must be a [data.frame], must have a column named `"mo"` which contains values from [`microorganisms$mo`][microorganisms] and must have a reference column with your own defined values. If all tests pass, [set_mo_source()] will read the file into R and will ask to export it to `"~/mo_source.rds"`. The CRAN policy disallows packages to write to the file system, although '*exceptions may be allowed in interactive sessions if the package obtains confirmation from the user*'. For this reason, this function only works in interactive sessions so that the user can **specifically confirm and allow** that this file will be created. The destination of this file can be set with the `destination` parameter and defaults to the user's home directory. It can also be set as an \R option, using `options(AMR_mo_source = "my/location/file.rds)`.
#' #'
#' The created compressed data file `"~/.mo_source.rds"` will be used at default for MO determination (function [as.mo()] and consequently all `mo_*` functions like [mo_genus()] and [mo_gramstain()]). The location of the original file will be saved as an R option with `options(mo_source = path)`. Its timestamp will be saved with `options(mo_source_datetime = ...)`. #' The created compressed data file `"mo_source.rds"` will be used at default for MO determination (function [as.mo()] and consequently all `mo_*` functions like [mo_genus()] and [mo_gramstain()]). The location and timestamp of the original file will be saved as an attribute to the compressed data file.
#' #'
#' The function [get_mo_source()] will return the data set by reading `"~/.mo_source.rds"` with [readRDS()]. If the original file has changed (by checking the aforementioned options `mo_source` and `mo_source_datetime`), it will call [set_mo_source()] to update the data file automatically if used in an interactive session. #' The function [get_mo_source()] will return the data set by reading `"mo_source.rds"` with [readRDS()]. If the original file has changed (by checking the location and timestamp of the original file), it will call [set_mo_source()] to update the data file automatically if used in an interactive session.
#' #'
#' Reading an Excel file (`.xlsx`) with only one row has a size of 8-9 kB. The compressed file created with [set_mo_source()] will then have a size of 0.1 kB and can be read by [get_mo_source()] in only a couple of microseconds (millionths of a second). #' Reading an Excel file (`.xlsx`) with only one row has a size of 8-9 kB. The compressed file created with [set_mo_source()] will then have a size of 0.1 kB and can be read by [get_mo_source()] in only a couple of microseconds (millionths of a second).
#' #'
@ -60,16 +61,18 @@
#' #'
#' ``` #' ```
#' set_mo_source("home/me/ourcodes.xlsx") #' set_mo_source("home/me/ourcodes.xlsx")
#' #> NOTE: Created mo_source file '~/.mo_source.rds' from 'home/me/ourcodes.xlsx' #' #> NOTE: Created mo_source file '/Users/me/mo_source.rds' (0.3 kB) from
#' #> (columns "Organisation XYZ" and "mo") #' #> '/Users/me/Documents/ourcodes.xlsx' (9 kB), columns
#' #> "Organisation XYZ" and "mo"
#' ``` #' ```
#' #'
#' It has now created a file `"~/.mo_source.rds"` with the contents of our Excel file. Only the first column with foreign values and the 'mo' column will be kept when creating the RDS file. #' It has now created a file `"~/mo_source.rds"` with the contents of our Excel file. Only the first column with foreign values and the 'mo' column will be kept when creating the RDS file.
#' #'
#' And now we can use it in our functions: #' And now we can use it in our functions:
#' #'
#' ``` #' ```
#' as.mo("lab_mo_ecoli") #' as.mo("lab_mo_ecoli")
#' #> Class <mo>
#' #> [1] B_ESCHR_COLI #' #> [1] B_ESCHR_COLI
#' #'
#' mo_genus("lab_mo_kpneumoniae") #' mo_genus("lab_mo_kpneumoniae")
@ -77,6 +80,9 @@
#' #'
#' # other input values still work too #' # other input values still work too
#' as.mo(c("Escherichia coli", "E. coli", "lab_mo_ecoli")) #' as.mo(c("Escherichia coli", "E. coli", "lab_mo_ecoli"))
#' #> NOTE: Translation to one microorganism was guessed with uncertainty.
#' #> Use mo_uncertainties() to review it.
#' #> Class <mo>
#' #> [1] B_ESCHR_COLI B_ESCHR_COLI B_ESCHR_COLI #' #> [1] B_ESCHR_COLI B_ESCHR_COLI B_ESCHR_COLI
#' ``` #' ```
#' #'
@ -96,8 +102,10 @@
#' #'
#' ``` #' ```
#' as.mo("lab_mo_ecoli") #' as.mo("lab_mo_ecoli")
#' #> NOTE: Updated mo_source file '~/.mo_source.rds' from 'home/me/ourcodes.xlsx' #' #> NOTE: Updated mo_source file '/Users/me/mo_source.rds' (0.3 kB) from
#' #> (columns "Organisation XYZ" and "mo") #' #> '/Users/me/Documents/ourcodes.xlsx' (9 kB), columns
#' #> "Organisation XYZ" and "mo"
#' #> Class <mo>
#' #> [1] B_ESCHR_COLI #' #> [1] B_ESCHR_COLI
#' #'
#' mo_genus("lab_Staph_aureus") #' mo_genus("lab_Staph_aureus")
@ -108,25 +116,26 @@
#' #'
#' ``` #' ```
#' set_mo_source(NULL) #' set_mo_source(NULL)
#' # Removed mo_source file '~/.mo_source.rds'. #' #> Removed mo_source file '/Users/me/mo_source.rds'
#' ``` #' ```
#' #'
#' If the original Excel file is moved or deleted, the mo_source file will be removed upon the next use of [as.mo()]. If the mo_source file is manually deleted (i.e. without using [set_mo_source()]), the references to the mo_source file will be removed upon the next use of [as.mo()]. #' If the original Excel file is moved or deleted, the mo_source file will be removed upon the next use of [as.mo()].
#' @export #' @export
#' @inheritSection AMR Read more on our website! #' @inheritSection AMR Read more on our website!
set_mo_source <- function(path) { set_mo_source <- function(path, destination = getOption("AMR_mo_source", "~/mo_source.rds")) {
meet_criteria(path, allow_class = "character", has_length = 1) meet_criteria(path, allow_class = "character", has_length = 1, allow_NULL = TRUE)
meet_criteria(destination, allow_class = "character", has_length = 1)
stop_ifnot(destination %like% "[.]rds$", "the `destination` must be a file location with file extension .rds")
file_location <- path.expand("~/mo_source.rds") mo_source_destination <- path.expand(destination)
stop_ifnot(interactive(), "This function can only be used in interactive mode, since it must ask for the user's permission to write a file to their home folder.") stop_ifnot(interactive(), "This function can only be used in interactive mode, since it must ask for the user's permission to write a file to their home folder.")
if (is.null(path) || path %in% c(FALSE, "")) { if (is.null(path) || path %in% c(FALSE, "")) {
options(mo_source = NULL) mo_env$mo_source <- NULL
options(mo_source_timestamp = NULL) if (file.exists(mo_source_destination)) {
if (file.exists(file_location)) { unlink(mo_source_destination)
unlink(file_location) message_("Removed mo_source file '", font_bold(mo_source_destination), "'",
message_("Removed mo_source file '", font_bold(file_location), "'",
add_fn = font_red, add_fn = font_red,
as_note = FALSE) as_note = FALSE)
} }
@ -178,16 +187,19 @@ set_mo_source <- function(path) {
} }
df <- as.data.frame(df, stringAsFactors = FALSE) df <- as.data.frame(df, stringAsFactors = FALSE)
df[, "mo"] <- set_clean_class(df[, "mo", drop = TRUE], c("mo", "character"))
# success # success
if (file.exists(file_location)) { if (file.exists(mo_source_destination)) {
action <- "Updated" action <- "Updated"
} else { } else {
action <- "Created" action <- "Created"
# only ask when file is created, not when it is updated # only ask when file is created, not when it is updated
txt <- paste0("This will write create the new file '", txt <- paste0(word_wrap(paste0("This will write create the new file '",
file_location, mo_source_destination,
"', for which your permission is needed.\n\nDo you agree that this file will be created? ") "', for which your permission is needed.")),
"\n\n",
word_wrap("Do you agree that this file will be created?"))
if ("rsasdtudioapi" %in% rownames(utils::installed.packages())) { if ("rsasdtudioapi" %in% rownames(utils::installed.packages())) {
showQuestion <- import_fn("showQuestion", "rstudioapi") showQuestion <- import_fn("showQuestion", "rstudioapi")
q_continue <- showQuestion("Create new file in home directory", txt) q_continue <- showQuestion("Create new file in home directory", txt)
@ -198,42 +210,38 @@ set_mo_source <- function(path) {
return(invisible()) return(invisible())
} }
} }
saveRDS(df, file_location) attr(df, "mo_source_location") <- path
options(mo_source = path) attr(df, "mo_source_timestamp") <- file.mtime(path)
options(mo_source_timestamp = as.character(file.info(path)$mtime)) saveRDS(df, mo_source_destination)
message_(action, " mo_source file '", font_bold(file_location), "'", mo_env$mo_source <- df
" from '", font_bold(path), "'", message_(action, " mo_source file '", font_bold(mo_source_destination),
'(columns "', colnames(df)[1], '" and "', colnames(df)[2], '")') "' (", formatted_filesize(mo_source_destination),
") from '", font_bold(path),
"' (", formatted_filesize(path),
'), columns "', colnames(df)[1], '" and "', colnames(df)[2], '"')
} }
#' @rdname mo_source #' @rdname mo_source
#' @export #' @export
get_mo_source <- function() { get_mo_source <- function(destination = getOption("AMR_mo_source", "~/mo_source.rds")) {
if (is.null(getOption("mo_source", NULL))) { if (!file.exists(path.expand(destination))) {
if (interactive()) {
# source file might have been deleted, update reference
set_mo_source("")
}
return(NULL) return(NULL)
} }
if (is.null(mo_env$mo_source)) {
if (!file.exists(path.expand("~/mo_source.rds"))) { mo_env$mo_source <- readRDS(path.expand(destination))
options(mo_source = NULL)
options(mo_source_timestamp = NULL)
message_("Removed references to deleted mo_source file (see ?mo_source)")
return(NULL)
} }
old_time <- as.POSIXct(getOption("mo_source_timestamp")) old_time <- attributes(mo_env$mo_source)$mo_source_timestamp
new_time <- as.POSIXct(as.character(file.info(getOption("mo_source", ""))$mtime)) new_time <- file.mtime(attributes(mo_env$mo_source)$mo_source_location)
if (interactive() && !identical(old_time, new_time)) {
if (is.na(new_time)) { # source file was updated, also update reference
# source file was deleted, remove reference too set_mo_source(attributes(mo_env$mo_source)$mo_source_location)
set_mo_source("")
return(NULL)
} }
if (interactive() && new_time != old_time) { mo_env$mo_source
# set updated source
set_mo_source(getOption("mo_source"))
}
file_location <- path.expand("~/mo_source.rds")
readRDS(file_location)
} }
mo_source_isvalid <- function(x, refer_to_name = "`reference_df`", stop_on_error = TRUE) { mo_source_isvalid <- function(x, refer_to_name = "`reference_df`", stop_on_error = TRUE) {
@ -242,7 +250,7 @@ mo_source_isvalid <- function(x, refer_to_name = "`reference_df`", stop_on_error
if (paste(deparse(substitute(x)), collapse = "") == "get_mo_source()") { if (paste(deparse(substitute(x)), collapse = "") == "get_mo_source()") {
return(TRUE) return(TRUE)
} }
if (identical(x, get_mo_source())) { if (is.null(mo_env$mo_source) && (identical(x, get_mo_source()))) {
return(TRUE) return(TRUE)
} }
if (is.null(x)) { if (is.null(x)) {

View File

@ -34,9 +34,9 @@
#' @param as_percent a logical to indicate whether the output must be returned as a hundred fold with % sign (a character). A value of `0.123456` will then be returned as `"12.3%"`. #' @param as_percent a logical to indicate whether the output must be returned as a hundred fold with % sign (a character). A value of `0.123456` will then be returned as `"12.3%"`.
#' @param only_all_tested (for combination therapies, i.e. using more than one variable for `...`): a logical to indicate that isolates must be tested for all antibiotics, see section *Combination therapy* below #' @param only_all_tested (for combination therapies, i.e. using more than one variable for `...`): a logical to indicate that isolates must be tested for all antibiotics, see section *Combination therapy* below
#' @param data a [data.frame] containing columns with class [`rsi`] (see [as.rsi()]) #' @param data a [data.frame] containing columns with class [`rsi`] (see [as.rsi()])
#' @param translate_ab a column name of the [antibiotics] data set to translate the antibiotic abbreviations to, using [ab_property()]. Use a value #' @param translate_ab a column name of the [antibiotics] data set to translate the antibiotic abbreviations to, using [ab_property()]
#' @inheritParams ab_property #' @inheritParams ab_property
#' @param combine_SI a logical to indicate whether all values of S and I must be merged into one, so the output only consists of S+I vs. R (susceptible vs. resistant). This used to be the parameter `combine_IR`, but this now follows the redefinition by EUCAST about the interpretion of I (increased exposure) in 2019, see section 'Interpretation of S, I and R' below. Default is `TRUE`. #' @param combine_SI a logical to indicate whether all values of S and I must be merged into one, so the output only consists of S+I vs. R (susceptible vs. resistant). This used to be the parameter `combine_IR`, but this now follows the redefinition by EUCAST about the interpretation of I (increased exposure) in 2019, see section 'Interpretation of S, I and R' below. Default is `TRUE`.
#' @param combine_IR a logical to indicate whether all values of I and R must be merged into one, so the output only consists of S vs. I+R (susceptible vs. non-susceptible). This is outdated, see parameter `combine_SI`. #' @param combine_IR a logical to indicate whether all values of I and R must be merged into one, so the output only consists of S vs. I+R (susceptible vs. non-susceptible). This is outdated, see parameter `combine_SI`.
#' @inheritSection as.rsi Interpretation of R and S/I #' @inheritSection as.rsi Interpretation of R and S/I
#' @details #' @details

View File

@ -34,7 +34,7 @@
#' @param year_every unit of sequence between lowest year found in the data and `year_max` #' @param year_every unit of sequence between lowest year found in the data and `year_max`
#' @param minimum minimal amount of available isolates per year to include. Years containing less observations will be estimated by the model. #' @param minimum minimal amount of available isolates per year to include. Years containing less observations will be estimated by the model.
#' @param model the statistical model of choice. This could be a generalised linear regression model with binomial distribution (i.e. using `glm(..., family = binomial)``, assuming that a period of zero resistance was followed by a period of increasing resistance leading slowly to more and more resistance. See Details for all valid options. #' @param model the statistical model of choice. This could be a generalised linear regression model with binomial distribution (i.e. using `glm(..., family = binomial)``, assuming that a period of zero resistance was followed by a period of increasing resistance leading slowly to more and more resistance. See Details for all valid options.
#' @param I_as_S a logical to indicate whether values `I` should be treated as `S` (will otherwise be treated as `R`). The default, `TRUE`, follows the redefinition by EUCAST about the interpretion of I (increased exposure) in 2019, see section *Interpretation of S, I and R* below. #' @param I_as_S a logical to indicate whether values `"I"` should be treated as `"S"` (will otherwise be treated as `"R"`). The default, `TRUE`, follows the redefinition by EUCAST about the interpretation of I (increased exposure) in 2019, see section *Interpretation of S, I and R* below.
#' @param preserve_measurements a logical to indicate whether predictions of years that are actually available in the data should be overwritten by the original data. The standard errors of those years will be `NA`. #' @param preserve_measurements a logical to indicate whether predictions of years that are actually available in the data should be overwritten by the original data. The standard errors of those years will be `NA`.
#' @param info a logical to indicate whether textual analysis should be printed with the name and [summary()] of the statistical model. #' @param info a logical to indicate whether textual analysis should be printed with the name and [summary()] of the statistical model.
#' @param main title of the plot #' @param main title of the plot

46
R/rsi.R
View File

@ -481,7 +481,7 @@ as.rsi.data.frame <- function(x,
meet_criteria(conserve_capped_values, allow_class = "logical", has_length = 1) meet_criteria(conserve_capped_values, allow_class = "logical", has_length = 1)
meet_criteria(add_intrinsic_resistance, allow_class = "logical", has_length = 1) meet_criteria(add_intrinsic_resistance, allow_class = "logical", has_length = 1)
meet_criteria(reference_data, allow_class = "data.frame") meet_criteria(reference_data, allow_class = "data.frame")
for (i in seq_len(ncol(x))) { for (i in seq_len(ncol(x))) {
# don't keep factors # don't keep factors
if (is.factor(x[, i, drop = TRUE])) { if (is.factor(x[, i, drop = TRUE])) {
@ -494,7 +494,7 @@ as.rsi.data.frame <- function(x,
if (is.null(col_mo)) { if (is.null(col_mo)) {
col_mo <- search_type_in_df(x = x, type = "mo", info = FALSE) col_mo <- search_type_in_df(x = x, type = "mo", info = FALSE)
} }
# -- UTIs # -- UTIs
col_uti <- uti col_uti <- uti
if (is.null(col_uti)) { if (is.null(col_uti)) {
@ -535,12 +535,13 @@ as.rsi.data.frame <- function(x,
uti <- FALSE uti <- FALSE
} }
} }
i <- 0 i <- 0
sel <- colnames(pm_select(x, ...)) sel <- colnames(pm_select(x, ...))
if (!is.null(col_mo)) { if (!is.null(col_mo)) {
sel <- sel[sel != col_mo] sel <- sel[sel != col_mo]
} }
ab_cols <- colnames(x)[sapply(x, function(y) { ab_cols <- colnames(x)[sapply(x, function(y) {
i <<- i + 1 i <<- i + 1
check <- is.mic(y) | is.disk(y) check <- is.mic(y) | is.disk(y)
@ -563,17 +564,16 @@ as.rsi.data.frame <- function(x,
return(FALSE) return(FALSE)
} }
})] })]
stop_if(length(ab_cols) == 0, stop_if(length(ab_cols) == 0,
"no columns with MIC values, disk zones or antibiotic column names found in this data set. Use as.mic() or as.disk() to transform antimicrobial columns.") "no columns with MIC values, disk zones or antibiotic column names found in this data set. Use as.mic() or as.disk() to transform antimicrobial columns.")
# set type per column # set type per column
types <- character(length(ab_cols)) types <- character(length(ab_cols))
types[sapply(x[, ab_cols], is.disk)] <- "disk" types[sapply(x[, ab_cols, drop = FALSE], is.disk)] <- "disk"
types[types == "" & sapply(x[, ab_cols], all_valid_disks)] <- "disk" types[types == "" & sapply(x[, ab_cols, drop = FALSE], all_valid_disks)] <- "disk"
types[sapply(x[, ab_cols], is.mic)] <- "mic" types[sapply(x[, ab_cols, drop = FALSE], is.mic)] <- "mic"
types[types == "" & sapply(x[, ab_cols], all_valid_mics)] <- "mic" types[types == "" & sapply(x[, ab_cols, drop = FALSE], all_valid_mics)] <- "mic"
types[types == "" & !sapply(x[, ab_cols], is.rsi)] <- "rsi" types[types == "" & !sapply(x[, ab_cols, drop = FALSE], is.rsi)] <- "rsi"
if (any(types %in% c("mic", "disk"), na.rm = TRUE)) { if (any(types %in% c("mic", "disk"), na.rm = TRUE)) {
# now we need an mo column # now we need an mo column
stop_if(is.null(col_mo), "`col_mo` must be set") stop_if(is.null(col_mo), "`col_mo` must be set")
@ -582,9 +582,9 @@ as.rsi.data.frame <- function(x,
col_mo <- search_type_in_df(x = x, type = "mo") col_mo <- search_type_in_df(x = x, type = "mo")
} }
} }
x_mo <- as.mo(x %pm>% pm_pull(col_mo)) x_mo <- as.mo(x %pm>% pm_pull(col_mo))
for (i in seq_len(length(ab_cols))) { for (i in seq_len(length(ab_cols))) {
if (types[i] == "mic") { if (types[i] == "mic") {
x[, ab_cols[i]] <- as.rsi(x = x %pm>% x[, ab_cols[i]] <- as.rsi(x = x %pm>%
@ -845,19 +845,22 @@ freq.rsi <- function(x, ...) {
}))[1L] }))[1L]
} }
ab <- suppressMessages(suppressWarnings(as.ab(x_name))) ab <- suppressMessages(suppressWarnings(as.ab(x_name)))
freq.default <- import_fn("freq.default", "cleaner", error_on_fail = FALSE)
digits <- list(...)$digits digits <- list(...)$digits
if (is.null(digits)) { if (is.null(digits)) {
digits <- 2 digits <- 2
} }
if (!is.na(ab)) { if (!is.na(ab)) {
freq.default(x = x, ..., cleaner::freq.default(x = x, ...,
.add_header = list(Drug = paste0(ab_name(ab, language = NULL), " (", ab, ", ", ab_atc(ab), ")"), .add_header = list(
`Drug group` = ab_group(ab, language = NULL), Drug = paste0(ab_name(ab, language = NULL), " (", ab, ", ", ab_atc(ab), ")"),
`%SI` = percentage(susceptibility(x, minimum = 0, as_percent = FALSE), digits = digits))) `Drug group` = ab_group(ab, language = NULL),
`%SI` = percentage(susceptibility(x, minimum = 0, as_percent = FALSE),
digits = digits)))
} else { } else {
freq.default(x = x, ..., cleaner::freq.default(x = x, ...,
.add_header = list(`%SI` = percentage(susceptibility(x, minimum = 0, as_percent = FALSE), digits = digits))) .add_header = list(
`%SI` = percentage(susceptibility(x, minimum = 0, as_percent = FALSE),
digits = digits)))
} }
} }
@ -892,8 +895,7 @@ get_skimmers.rsi <- function(column) {
} }
} }
sfl <- import_fn("sfl", "skimr", error_on_fail = FALSE) skimr::sfl(
sfl(
skim_type = "rsi", skim_type = "rsi",
ab_name = name_call, ab_name = name_call,
count_R = count_R, count_R = count_R,
@ -916,7 +918,7 @@ print.rsi <- function(x, ...) {
#' @method droplevels rsi #' @method droplevels rsi
#' @export #' @export
#' @noRd #' @noRd
droplevels.rsi <- function(x, exclude = if (anyNA(levels(x))) NULL else NA, ...) { droplevels.rsi <- function(x, exclude = if (any(is.na(levels(x)))) NULL else NA, ...) {
x <- droplevels.factor(x, exclude = exclude, ...) x <- droplevels.factor(x, exclude = exclude, ...)
class(x) <- c("rsi", "ordered", "factor") class(x) <- c("rsi", "ordered", "factor")
x x

View File

@ -96,7 +96,11 @@ rsi_calc <- function(...,
if (is.null(x)) { if (is.null(x)) {
warning_("argument is NULL (check if columns exist): returning NA", call = FALSE) warning_("argument is NULL (check if columns exist): returning NA", call = FALSE)
return(NA) if (as_percent == TRUE) {
return(NA_character_)
} else {
return(NA_real_)
}
} }
print_warning <- FALSE print_warning <- FALSE

View File

@ -27,7 +27,7 @@
#' #'
#' For language-dependent output of AMR functions, like [mo_name()], [mo_gramstain()], [mo_type()] and [ab_name()]. #' For language-dependent output of AMR functions, like [mo_name()], [mo_gramstain()], [mo_type()] and [ab_name()].
#' @inheritSection lifecycle Stable lifecycle #' @inheritSection lifecycle Stable lifecycle
#' @details Strings will be translated to foreign languages if they are defined in a local translation file. Additions to this file can be suggested at our repository. The file can be found here: <https://github.com/msberends/AMR/blob/master/data-raw/translations.tsv>. This file will be read by all functions where a translated output can be desired, like all [mo_property()] functions ([mo_name()], [mo_gramstain()], [mo_type()], etc.) and [ab_property()] functions ([ab_name()], [ab_group()] etc.). #' @details Strings will be translated to foreign languages if they are defined in a local translation file. Additions to this file can be suggested at our repository. The file can be found here: <https://github.com/msberends/AMR/blob/master/data-raw/translations.tsv>. This file will be read by all functions where a translated output can be desired, like all [`mo_*`][mo_property()] functions (such as [mo_name()], [mo_gramstain()], [mo_type()], etc.) and [`ab_*`][ab_property()] functions (such as [ab_name()], [ab_group()], etc.).
#' #'
#' Currently supported languages are: `r paste(sort(gsub(";.*", "", ISOcodes::ISO_639_2[which(ISOcodes::ISO_639_2$Alpha_2 %in% LANGUAGES_SUPPORTED), "Name"])), collapse = ", ")`. Please note that currently not all these languages have translations available for all antimicrobial agents and colloquial microorganism names. #' Currently supported languages are: `r paste(sort(gsub(";.*", "", ISOcodes::ISO_639_2[which(ISOcodes::ISO_639_2$Alpha_2 %in% LANGUAGES_SUPPORTED), "Name"])), collapse = ", ")`. Please note that currently not all these languages have translations available for all antimicrobial agents and colloquial microorganism names.
#' #'
@ -96,7 +96,7 @@ get_locale <- function() {
} }
} }
coerce_language_setting(Sys.getlocale()) coerce_language_setting(Sys.getlocale("LC_COLLATE"))
} }
coerce_language_setting <- function(lang) { coerce_language_setting <- function(lang) {

View File

@ -24,6 +24,7 @@
# ==================================================================== # # ==================================================================== #
.onLoad <- function(libname, pkgname) { .onLoad <- function(libname, pkgname) {
assign(x = "AB_lookup", assign(x = "AB_lookup",
value = create_AB_lookup(), value = create_AB_lookup(),
envir = asNamespace("AMR")) envir = asNamespace("AMR"))

View File

@ -75,3 +75,7 @@ contents <- gsub("pm_distinct <- function(.data, ..., .keep_all = FALSE)", "pm_d
contents <- contents[!grepl("summarize", contents)] contents <- contents[!grepl("summarize", contents)]
writeLines(contents, "R/aa_helper_pm_functions.R") writeLines(contents, "R/aa_helper_pm_functions.R")
# after this, comment out:
# pm_left_join() since we use a faster version
# pm_group_split() since we don't use it and it relies on R 3.5.0 for the use of ...length(), which is hard to support with C++ code

View File

@ -81,7 +81,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="https://msberends.github.io/AMR//index.html">AMR (for R)</a> <a class="navbar-link" href="https://msberends.github.io/AMR//index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9040</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9041</span>
</span> </span>
</div> </div>

View File

@ -81,7 +81,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9040</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9041</span>
</span> </span>
</div> </div>

View File

@ -39,7 +39,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9032</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9041</span>
</span> </span>
</div> </div>
@ -47,14 +47,14 @@
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li> <li>
<a href="../index.html"> <a href="../index.html">
<span class="fa fa-home"></span> <span class="fas fa-home"></span>
Home Home
</a> </a>
</li> </li>
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<span class="fa fa-question-circle"></span> <span class="fas fa-question-circle"></span>
How to How to
@ -63,77 +63,77 @@
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
<li> <li>
<a href="../articles/AMR.html"> <a href="../articles/AMR.html">
<span class="fa fa-directions"></span> <span class="fas fa-directions"></span>
Conduct AMR analysis Conduct AMR analysis
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/resistance_predict.html"> <a href="../articles/resistance_predict.html">
<span class="fa fa-dice"></span> <span class="fas fa-dice"></span>
Predict antimicrobial resistance Predict antimicrobial resistance
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/datasets.html"> <a href="../articles/datasets.html">
<span class="fa fa-database"></span> <span class="fas fa-database"></span>
Data sets for download / own use Data sets for download / own use
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/PCA.html"> <a href="../articles/PCA.html">
<span class="fa fa-compress"></span> <span class="fas fa-compress"></span>
Conduct principal component analysis for AMR Conduct principal component analysis for AMR
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/MDR.html"> <a href="../articles/MDR.html">
<span class="fa fa-skull-crossbones"></span> <span class="fas fa-skull-crossbones"></span>
Determine multi-drug resistance (MDR) Determine multi-drug resistance (MDR)
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/WHONET.html"> <a href="../articles/WHONET.html">
<span class="fa fa-globe-americas"></span> <span class="fas fa-globe-americas"></span>
Work with WHONET data Work with WHONET data
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/SPSS.html"> <a href="../articles/SPSS.html">
<span class="fa fa-file-upload"></span> <span class="fas fa-file-upload"></span>
Import data from SPSS/SAS/Stata Import data from SPSS/SAS/Stata
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/EUCAST.html"> <a href="../articles/EUCAST.html">
<span class="fa fa-exchange-alt"></span> <span class="fas fa-exchange-alt"></span>
Apply EUCAST rules Apply EUCAST rules
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/mo_property.html"> <a href="../reference/mo_property.html">
<span class="fa fa-bug"></span> <span class="fas fa-bug"></span>
Get properties of a microorganism Get properties of a microorganism
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/ab_property.html"> <a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span> <span class="fas fa-capsules"></span>
Get properties of an antibiotic Get properties of an antibiotic
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/benchmarks.html"> <a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span> <span class="fas fa-shipping-fast"></span>
Other: benchmarks Other: benchmarks
</a> </a>
@ -142,21 +142,21 @@
</li> </li>
<li> <li>
<a href="../reference/index.html"> <a href="../reference/index.html">
<span class="fa fa-book-open"></span> <span class="fas fa-book-open"></span>
Manual Manual
</a> </a>
</li> </li>
<li> <li>
<a href="../authors.html"> <a href="../authors.html">
<span class="fa fa-users"></span> <span class="fas fa-users"></span>
Authors Authors
</a> </a>
</li> </li>
<li> <li>
<a href="../news/index.html"> <a href="../news/index.html">
<span class="far fa far fa-newspaper"></span> <span class="far fa-newspaper"></span>
Changelog Changelog
</a> </a>
@ -165,14 +165,14 @@
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li> <li>
<a href="https://github.com/msberends/AMR"> <a href="https://github.com/msberends/AMR">
<span class="fab fa fab fa-github"></span> <span class="fab fa-github"></span>
Source Code Source Code
</a> </a>
</li> </li>
<li> <li>
<a href="../survey.html"> <a href="../survey.html">
<span class="fa fa-clipboard-list"></span> <span class="fas fa-clipboard-list"></span>
Survey Survey
</a> </a>
@ -187,7 +187,7 @@
</header><script src="datasets_files/header-attrs-2.4/header-attrs.js"></script><script src="datasets_files/accessible-code-block-0.0.1/empty-anchor.js"></script><div class="row"> </header><script src="datasets_files/header-attrs-2.6/header-attrs.js"></script><div class="row">
<div class="col-md-9 contents"> <div class="col-md-9 contents">
<div class="page-header toc-ignore"> <div class="page-header toc-ignore">
<h1 data-toc-skip>Data sets for download / own use</h1> <h1 data-toc-skip>Data sets for download / own use</h1>

View File

@ -0,0 +1,12 @@
// Pandoc 2.9 adds attributes on both header and div. We remove the former (to
// be compatible with the behavior of Pandoc < 2.8).
document.addEventListener('DOMContentLoaded', function(e) {
var hs = document.querySelectorAll("div.section[class*='level'] > :first-child");
var i, h, a;
for (i = 0; i < hs.length; i++) {
h = hs[i];
if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6
a = h.attributes;
while (a.length > 0) h.removeAttribute(a[0].name);
}
});

View File

@ -81,7 +81,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9040</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9041</span>
</span> </span>
</div> </div>

View File

@ -81,7 +81,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9040</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9041</span>
</span> </span>
</div> </div>

View File

@ -43,7 +43,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9040</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9041</span>
</span> </span>
</div> </div>

View File

@ -81,7 +81,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9040</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9041</span>
</span> </span>
</div> </div>
@ -236,14 +236,15 @@
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small> <small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
</div> </div>
<div id="amr-1409040" class="section level1"> <div id="amr-1409041" class="section level1">
<h1 class="page-header" data-toc-text="1.4.0.9040"> <h1 class="page-header" data-toc-text="1.4.0.9041">
<a href="#amr-1409040" class="anchor"></a>AMR 1.4.0.9040<small> Unreleased </small> <a href="#amr-1409041" class="anchor"></a>AMR 1.4.0.9041<small> Unreleased </small>
</h1> </h1>
<div id="last-updated-16-december-2020" class="section level2"> <div id="last-updated-17-december-2020" class="section level2">
<h2 class="hasAnchor"> <h2 class="hasAnchor">
<a href="#last-updated-16-december-2020" class="anchor"></a><small>Last updated: 16 December 2020</small> <a href="#last-updated-17-december-2020" class="anchor"></a><small>Last updated: 17 December 2020</small>
</h2> </h2>
<p>Note: some changes in this version were suggested by anonymous reviewers from the journal we submitted our manuscript about this package to. We are those reviewers very grateful for going through our code so thoroughly!</p>
<div id="new" class="section level3"> <div id="new" class="section level3">
<h3 class="hasAnchor"> <h3 class="hasAnchor">
<a href="#new" class="anchor"></a>New</h3> <a href="#new" class="anchor"></a>New</h3>
@ -280,6 +281,7 @@
<span class="fu"><a href="https://tibble.tidyverse.org/reference/as_tibble.html">as_tibble</a></span><span class="op">(</span><span class="op">)</span></code></pre></div> <span class="fu"><a href="https://tibble.tidyverse.org/reference/as_tibble.html">as_tibble</a></span><span class="op">(</span><span class="op">)</span></code></pre></div>
</li> </li>
<li><p>For all function parameters in the code, it is now defined what the exact type of user input should be (inspired by the <a href="https://github.com/moodymudskipper/typed"><code>typed</code></a> package). If the user input for a certain function does not meet the requirements for a specific parameter (such as the class or length), an informative error will be thrown. This makes the package more robust and the use of it more reproducible and reliable. In total, more than 400 arguments were defined.</p></li> <li><p>For all function parameters in the code, it is now defined what the exact type of user input should be (inspired by the <a href="https://github.com/moodymudskipper/typed"><code>typed</code></a> package). If the user input for a certain function does not meet the requirements for a specific parameter (such as the class or length), an informative error will be thrown. This makes the package more robust and the use of it more reproducible and reliable. In total, more than 400 arguments were defined.</p></li>
<li><p>Fix for <code><a href="../reference/mo_source.html">set_mo_source()</a></code>, that previously would not remember the file location of the original file</p></li>
<li><p>Deprecated function <code><a href="../reference/AMR-deprecated.html">p_symbol()</a></code> that not really fits the scope of this package. It will be removed in a future version. See <a href="https://github.com/msberends/AMR/blob/v1.4.0/R/p_symbol.R">here</a> for the source code to preserve it.</p></li> <li><p>Deprecated function <code><a href="../reference/AMR-deprecated.html">p_symbol()</a></code> that not really fits the scope of this package. It will be removed in a future version. See <a href="https://github.com/msberends/AMR/blob/v1.4.0/R/p_symbol.R">here</a> for the source code to preserve it.</p></li>
<li><p>Better determination of disk zones and MIC values when running <code><a href="../reference/as.rsi.html">as.rsi()</a></code> on a data.frame</p></li> <li><p>Better determination of disk zones and MIC values when running <code><a href="../reference/as.rsi.html">as.rsi()</a></code> on a data.frame</p></li>
<li><p>Updated coagulase-negative staphylococci determination with Becker <em>et al.</em> 2020 (PMID 32056452), meaning that the species <em>S. argensis</em>, <em>S. caeli</em>, <em>S. debuckii</em>, <em>S. edaphicus</em> and <em>S. pseudoxylosus</em> are now all considered CoNS</p></li> <li><p>Updated coagulase-negative staphylococci determination with Becker <em>et al.</em> 2020 (PMID 32056452), meaning that the species <em>S. argensis</em>, <em>S. caeli</em>, <em>S. debuckii</em>, <em>S. edaphicus</em> and <em>S. pseudoxylosus</em> are now all considered CoNS</p></li>
@ -294,6 +296,7 @@
<li><p>Fix for plotting MIC values with <code><a href="../reference/plot.html">plot()</a></code></p></li> <li><p>Fix for plotting MIC values with <code><a href="../reference/plot.html">plot()</a></code></p></li>
<li><p>Added <code><a href="../reference/plot.html">plot()</a></code> generic to class <code>&lt;disk&gt;</code></p></li> <li><p>Added <code><a href="../reference/plot.html">plot()</a></code> generic to class <code>&lt;disk&gt;</code></p></li>
<li><p>LA-MRSA and CA-MRSA are now recognised as an abbreviation for <em>Staphylococcus aureus</em>, meaning that e.g. <code><a href="../reference/mo_property.html">mo_genus("LA-MRSA")</a></code> will return <code>"Staphylococcus"</code> and <code><a href="../reference/mo_property.html">mo_is_gram_positive("LA-MRSA")</a></code> will return <code>TRUE</code>.</p></li> <li><p>LA-MRSA and CA-MRSA are now recognised as an abbreviation for <em>Staphylococcus aureus</em>, meaning that e.g. <code><a href="../reference/mo_property.html">mo_genus("LA-MRSA")</a></code> will return <code>"Staphylococcus"</code> and <code><a href="../reference/mo_property.html">mo_is_gram_positive("LA-MRSA")</a></code> will return <code>TRUE</code>.</p></li>
<li><p>Fix for using <code><a href="../reference/as.rsi.html">as.rsi()</a></code> on a <code>data.frame</code> that only contains one column for antibiotic interpretations</p></li>
</ul> </ul>
</div> </div>
<div id="other" class="section level3"> <div id="other" class="section level3">
@ -302,6 +305,8 @@
<ul> <ul>
<li>All messages and warnings thrown by this package now break sentences on whole words</li> <li>All messages and warnings thrown by this package now break sentences on whole words</li>
<li>More extensive unit tests</li> <li>More extensive unit tests</li>
<li>Internal calls to <code><a href="https://rdrr.io/r/base/options.html">options()</a></code> were all removed in favour of a new internal environment <code>mo_env</code>
</li>
</ul> </ul>
</div> </div>
</div> </div>
@ -310,7 +315,7 @@
<h1 class="page-header" data-toc-text="1.4.0"> <h1 class="page-header" data-toc-text="1.4.0">
<a href="#amr-140" class="anchor"></a>AMR 1.4.0<small> 2020-10-08 </small> <a href="#amr-140" class="anchor"></a>AMR 1.4.0<small> 2020-10-08 </small>
</h1> </h1>
<p>Note: some changes in this version were suggested by anonymous reviewers from the journal we submitted our manuscipt about this package to. We are those reviewers very grateful for going through our code so thoroughly!</p> <p>Note: some changes in this version were suggested by anonymous reviewers from the journal we submitted our manuscript about this package to. We are those reviewers very grateful for going through our code so thoroughly!</p>
<div id="new-1" class="section level3"> <div id="new-1" class="section level3">
<h3 class="hasAnchor"> <h3 class="hasAnchor">
<a href="#new-1" class="anchor"></a>New</h3> <a href="#new-1" class="anchor"></a>New</h3>

View File

@ -12,7 +12,7 @@ articles:
datasets: datasets.html datasets: datasets.html
resistance_predict: resistance_predict.html resistance_predict: resistance_predict.html
welcome_to_AMR: welcome_to_AMR.html welcome_to_AMR: welcome_to_AMR.html
last_built: 2020-12-16T14:24Z last_built: 2020-12-17T15:22Z
urls: urls:
reference: https://msberends.github.io/AMR//reference reference: https://msberends.github.io/AMR//reference
article: https://msberends.github.io/AMR//articles article: https://msberends.github.io/AMR//articles

View File

@ -82,7 +82,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9040</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9041</span>
</span> </span>
</div> </div>
@ -258,8 +258,8 @@
<li><p>Determining multi-drug resistance (MDR) / multi-drug resistant organisms (MDRO)</p></li> <li><p>Determining multi-drug resistance (MDR) / multi-drug resistant organisms (MDRO)</p></li>
<li><p>Calculating (empirical) susceptibility of both mono therapy and combination therapies</p></li> <li><p>Calculating (empirical) susceptibility of both mono therapy and combination therapies</p></li>
<li><p>Predicting future antimicrobial resistance using regression models</p></li> <li><p>Predicting future antimicrobial resistance using regression models</p></li>
<li><p>Getting properties for any microorganism (like Gram stain, species, genus or family)</p></li> <li><p>Getting properties for any microorganism (such as Gram stain, species, genus or family)</p></li>
<li><p>Getting properties for any antibiotic (like name, code of EARS-Net/ATC/LOINC/PubChem, defined daily dose or trade name)</p></li> <li><p>Getting properties for any antibiotic (such as name, code of EARS-Net/ATC/LOINC/PubChem, defined daily dose or trade name)</p></li>
<li><p>Plotting antimicrobial resistance</p></li> <li><p>Plotting antimicrobial resistance</p></li>
<li><p>Applying EUCAST expert rules</p></li> <li><p>Applying EUCAST expert rules</p></li>
<li><p>Getting SNOMED codes of a microorganism, or getting properties of a microorganism based on a SNOMED code</p></li> <li><p>Getting SNOMED codes of a microorganism, or getting properties of a microorganism based on a SNOMED code</p></li>

View File

@ -82,7 +82,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9035</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9041</span>
</span> </span>
</div> </div>
@ -90,14 +90,14 @@
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li> <li>
<a href="../index.html"> <a href="../index.html">
<span class="fa fa-home"></span> <span class="fas fa-home"></span>
Home Home
</a> </a>
</li> </li>
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<span class="fa fa-question-circle"></span> <span class="fas fa-question-circle"></span>
How to How to
@ -106,77 +106,77 @@
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
<li> <li>
<a href="../articles/AMR.html"> <a href="../articles/AMR.html">
<span class="fa fa-directions"></span> <span class="fas fa-directions"></span>
Conduct AMR analysis Conduct AMR analysis
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/resistance_predict.html"> <a href="../articles/resistance_predict.html">
<span class="fa fa-dice"></span> <span class="fas fa-dice"></span>
Predict antimicrobial resistance Predict antimicrobial resistance
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/datasets.html"> <a href="../articles/datasets.html">
<span class="fa fa-database"></span> <span class="fas fa-database"></span>
Data sets for download / own use Data sets for download / own use
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/PCA.html"> <a href="../articles/PCA.html">
<span class="fa fa-compress"></span> <span class="fas fa-compress"></span>
Conduct principal component analysis for AMR Conduct principal component analysis for AMR
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/MDR.html"> <a href="../articles/MDR.html">
<span class="fa fa-skull-crossbones"></span> <span class="fas fa-skull-crossbones"></span>
Determine multi-drug resistance (MDR) Determine multi-drug resistance (MDR)
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/WHONET.html"> <a href="../articles/WHONET.html">
<span class="fa fa-globe-americas"></span> <span class="fas fa-globe-americas"></span>
Work with WHONET data Work with WHONET data
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/SPSS.html"> <a href="../articles/SPSS.html">
<span class="fa fa-file-upload"></span> <span class="fas fa-file-upload"></span>
Import data from SPSS/SAS/Stata Import data from SPSS/SAS/Stata
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/EUCAST.html"> <a href="../articles/EUCAST.html">
<span class="fa fa-exchange-alt"></span> <span class="fas fa-exchange-alt"></span>
Apply EUCAST rules Apply EUCAST rules
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/mo_property.html"> <a href="../reference/mo_property.html">
<span class="fa fa-bug"></span> <span class="fas fa-bug"></span>
Get properties of a microorganism Get properties of a microorganism
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/ab_property.html"> <a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span> <span class="fas fa-capsules"></span>
Get properties of an antibiotic Get properties of an antibiotic
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/benchmarks.html"> <a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span> <span class="fas fa-shipping-fast"></span>
Other: benchmarks Other: benchmarks
</a> </a>
@ -185,21 +185,21 @@
</li> </li>
<li> <li>
<a href="../reference/index.html"> <a href="../reference/index.html">
<span class="fa fa-book-open"></span> <span class="fas fa-book-open"></span>
Manual Manual
</a> </a>
</li> </li>
<li> <li>
<a href="../authors.html"> <a href="../authors.html">
<span class="fa fa-users"></span> <span class="fas fa-users"></span>
Authors Authors
</a> </a>
</li> </li>
<li> <li>
<a href="../news/index.html"> <a href="../news/index.html">
<span class="far fa far fa-newspaper"></span> <span class="far fa-newspaper"></span>
Changelog Changelog
</a> </a>
@ -208,14 +208,14 @@
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li> <li>
<a href="https://github.com/msberends/AMR"> <a href="https://github.com/msberends/AMR">
<span class="fab fa fab fa-github"></span> <span class="fab fa-github"></span>
Source Code Source Code
</a> </a>
</li> </li>
<li> <li>
<a href="../survey.html"> <a href="../survey.html">
<span class="fa fa-clipboard-list"></span> <span class="fas fa-clipboard-list"></span>
Survey Survey
</a> </a>
@ -297,7 +297,7 @@
<p>Without using <code>collapse</code>, this function will return a <a href='https://rdrr.io/r/base/list.html'>list</a>. This can be convenient to use e.g. inside a <code><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate()</a></code>):<br /> <p>Without using <code>collapse</code>, this function will return a <a href='https://rdrr.io/r/base/list.html'>list</a>. This can be convenient to use e.g. inside a <code><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate()</a></code>):<br />
<code>df %&gt;% mutate(abx = ab_from_text(clinical_text))</code></p> <code>df %&gt;% mutate(abx = ab_from_text(clinical_text))</code></p>
<p>The returned AB codes can be transformed to official names, groups, etc. with all <code><a href='ab_property.html'>ab_property()</a></code> functions like <code><a href='ab_property.html'>ab_name()</a></code> and <code><a href='ab_property.html'>ab_group()</a></code>, or by using the <code>translate_ab</code> parameter.</p> <p>The returned AB codes can be transformed to official names, groups, etc. with all <code><a href='ab_property.html'>ab_*</a></code> functions such as <code><a href='ab_property.html'>ab_name()</a></code> and <code><a href='ab_property.html'>ab_group()</a></code>, or by using the <code>translate_ab</code> parameter.</p>
<p>With using <code>collapse</code>, this function will return a <a href='https://rdrr.io/r/base/character.html'>character</a>:<br /> <p>With using <code>collapse</code>, this function will return a <a href='https://rdrr.io/r/base/character.html'>character</a>:<br />
<code>df %&gt;% mutate(abx = ab_from_text(clinical_text, collapse = "|"))</code></p> <code>df %&gt;% mutate(abx = ab_from_text(clinical_text, collapse = "|"))</code></p>

View File

@ -49,7 +49,7 @@
<script src="../extra.js"></script> <script src="../extra.js"></script>
<meta property="og:title" content="Data sets with 557 antimicrobials — antibiotics" /> <meta property="og:title" content="Data sets with 557 antimicrobials — antibiotics" />
<meta property="og:description" content="Two data sets containing all antibiotics/antimycotics and antivirals. Use as.ab() or one of the ab_property() functions to retrieve values from the antibiotics data set. Three identifiers are included in this data set: an antibiotic ID (ab, primarily used in this package) as defined by WHONET/EARS-Net, an ATC code (atc) as defined by the WHO, and a Compound ID (cid) as found in PubChem. Other properties in this data set are derived from one or more of these codes." /> <meta property="og:description" content="Two data sets containing all antibiotics/antimycotics and antivirals. Use as.ab() or one of the ab_* functions to retrieve values from the antibiotics data set. Three identifiers are included in this data set: an antibiotic ID (ab, primarily used in this package) as defined by WHONET/EARS-Net, an ATC code (atc) as defined by the WHO, and a Compound ID (cid) as found in PubChem. Other properties in this data set are derived from one or more of these codes." />
<meta property="og:image" content="https://msberends.github.io/AMR/logo.png" /> <meta property="og:image" content="https://msberends.github.io/AMR/logo.png" />
@ -82,7 +82,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9032</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9041</span>
</span> </span>
</div> </div>
@ -90,14 +90,14 @@
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li> <li>
<a href="../index.html"> <a href="../index.html">
<span class="fa fa-home"></span> <span class="fas fa-home"></span>
Home Home
</a> </a>
</li> </li>
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<span class="fa fa-question-circle"></span> <span class="fas fa-question-circle"></span>
How to How to
@ -106,77 +106,77 @@
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
<li> <li>
<a href="../articles/AMR.html"> <a href="../articles/AMR.html">
<span class="fa fa-directions"></span> <span class="fas fa-directions"></span>
Conduct AMR analysis Conduct AMR analysis
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/resistance_predict.html"> <a href="../articles/resistance_predict.html">
<span class="fa fa-dice"></span> <span class="fas fa-dice"></span>
Predict antimicrobial resistance Predict antimicrobial resistance
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/datasets.html"> <a href="../articles/datasets.html">
<span class="fa fa-database"></span> <span class="fas fa-database"></span>
Data sets for download / own use Data sets for download / own use
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/PCA.html"> <a href="../articles/PCA.html">
<span class="fa fa-compress"></span> <span class="fas fa-compress"></span>
Conduct principal component analysis for AMR Conduct principal component analysis for AMR
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/MDR.html"> <a href="../articles/MDR.html">
<span class="fa fa-skull-crossbones"></span> <span class="fas fa-skull-crossbones"></span>
Determine multi-drug resistance (MDR) Determine multi-drug resistance (MDR)
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/WHONET.html"> <a href="../articles/WHONET.html">
<span class="fa fa-globe-americas"></span> <span class="fas fa-globe-americas"></span>
Work with WHONET data Work with WHONET data
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/SPSS.html"> <a href="../articles/SPSS.html">
<span class="fa fa-file-upload"></span> <span class="fas fa-file-upload"></span>
Import data from SPSS/SAS/Stata Import data from SPSS/SAS/Stata
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/EUCAST.html"> <a href="../articles/EUCAST.html">
<span class="fa fa-exchange-alt"></span> <span class="fas fa-exchange-alt"></span>
Apply EUCAST rules Apply EUCAST rules
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/mo_property.html"> <a href="../reference/mo_property.html">
<span class="fa fa-bug"></span> <span class="fas fa-bug"></span>
Get properties of a microorganism Get properties of a microorganism
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/ab_property.html"> <a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span> <span class="fas fa-capsules"></span>
Get properties of an antibiotic Get properties of an antibiotic
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/benchmarks.html"> <a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span> <span class="fas fa-shipping-fast"></span>
Other: benchmarks Other: benchmarks
</a> </a>
@ -185,21 +185,21 @@
</li> </li>
<li> <li>
<a href="../reference/index.html"> <a href="../reference/index.html">
<span class="fa fa-book-open"></span> <span class="fas fa-book-open"></span>
Manual Manual
</a> </a>
</li> </li>
<li> <li>
<a href="../authors.html"> <a href="../authors.html">
<span class="fa fa-users"></span> <span class="fas fa-users"></span>
Authors Authors
</a> </a>
</li> </li>
<li> <li>
<a href="../news/index.html"> <a href="../news/index.html">
<span class="far fa far fa-newspaper"></span> <span class="far fa-newspaper"></span>
Changelog Changelog
</a> </a>
@ -208,14 +208,14 @@
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li> <li>
<a href="https://github.com/msberends/AMR"> <a href="https://github.com/msberends/AMR">
<span class="fab fa fab fa-github"></span> <span class="fab fa-github"></span>
Source Code Source Code
</a> </a>
</li> </li>
<li> <li>
<a href="../survey.html"> <a href="../survey.html">
<span class="fa fa-clipboard-list"></span> <span class="fas fa-clipboard-list"></span>
Survey Survey
</a> </a>
@ -239,7 +239,7 @@
</div> </div>
<div class="ref-description"> <div class="ref-description">
<p>Two data sets containing all antibiotics/antimycotics and antivirals. Use <code><a href='as.ab.html'>as.ab()</a></code> or one of the <code><a href='ab_property.html'>ab_property()</a></code> functions to retrieve values from the antibiotics data set. Three identifiers are included in this data set: an antibiotic ID (<code>ab</code>, primarily used in this package) as defined by WHONET/EARS-Net, an ATC code (<code>atc</code>) as defined by the WHO, and a Compound ID (<code>cid</code>) as found in PubChem. Other properties in this data set are derived from one or more of these codes.</p> <p>Two data sets containing all antibiotics/antimycotics and antivirals. Use <code><a href='as.ab.html'>as.ab()</a></code> or one of the <code><a href='ab_property.html'>ab_*</a></code> functions to retrieve values from the antibiotics data set. Three identifiers are included in this data set: an antibiotic ID (<code>ab</code>, primarily used in this package) as defined by WHONET/EARS-Net, an ATC code (<code>atc</code>) as defined by the WHO, and a Compound ID (<code>cid</code>) as found in PubChem. Other properties in this data set are derived from one or more of these codes.</p>
</div> </div>
<pre class="usage"><span class='va'>antibiotics</span> <pre class="usage"><span class='va'>antibiotics</span>
@ -253,7 +253,7 @@
<h3 class='hasAnchor' id='arguments'><a class='anchor' href='#arguments'></a>For the antibiotics data set: a <a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a> with 455 observations and 14 variables:</h3> <h3 class='hasAnchor' id='arguments'><a class='anchor' href='#arguments'></a>For the antibiotics data set: a <a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a> with 455 observations and 14 variables:</h3>
<ul> <ul>
<li><p><code>ab</code><br /> Antibiotic ID as used in this package (like <code>AMC</code>), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available</p></li> <li><p><code>ab</code><br /> Antibiotic ID as used in this package (such as <code>AMC</code>), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available</p></li>
<li><p><code>atc</code><br /> ATC code (Anatomical Therapeutic Chemical) as defined by the WHOCC, like <code>J01CR02</code></p></li> <li><p><code>atc</code><br /> ATC code (Anatomical Therapeutic Chemical) as defined by the WHOCC, like <code>J01CR02</code></p></li>
<li><p><code>cid</code><br /> Compound ID as found in PubChem</p></li> <li><p><code>cid</code><br /> Compound ID as found in PubChem</p></li>
<li><p><code>name</code><br /> Official name as used by WHONET/EARS-Net or the WHO</p></li> <li><p><code>name</code><br /> Official name as used by WHONET/EARS-Net or the WHO</p></li>

View File

@ -82,7 +82,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9032</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9041</span>
</span> </span>
</div> </div>
@ -90,14 +90,14 @@
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li> <li>
<a href="../index.html"> <a href="../index.html">
<span class="fa fa-home"></span> <span class="fas fa-home"></span>
Home Home
</a> </a>
</li> </li>
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<span class="fa fa-question-circle"></span> <span class="fas fa-question-circle"></span>
How to How to
@ -106,77 +106,77 @@
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
<li> <li>
<a href="../articles/AMR.html"> <a href="../articles/AMR.html">
<span class="fa fa-directions"></span> <span class="fas fa-directions"></span>
Conduct AMR analysis Conduct AMR analysis
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/resistance_predict.html"> <a href="../articles/resistance_predict.html">
<span class="fa fa-dice"></span> <span class="fas fa-dice"></span>
Predict antimicrobial resistance Predict antimicrobial resistance
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/datasets.html"> <a href="../articles/datasets.html">
<span class="fa fa-database"></span> <span class="fas fa-database"></span>
Data sets for download / own use Data sets for download / own use
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/PCA.html"> <a href="../articles/PCA.html">
<span class="fa fa-compress"></span> <span class="fas fa-compress"></span>
Conduct principal component analysis for AMR Conduct principal component analysis for AMR
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/MDR.html"> <a href="../articles/MDR.html">
<span class="fa fa-skull-crossbones"></span> <span class="fas fa-skull-crossbones"></span>
Determine multi-drug resistance (MDR) Determine multi-drug resistance (MDR)
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/WHONET.html"> <a href="../articles/WHONET.html">
<span class="fa fa-globe-americas"></span> <span class="fas fa-globe-americas"></span>
Work with WHONET data Work with WHONET data
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/SPSS.html"> <a href="../articles/SPSS.html">
<span class="fa fa-file-upload"></span> <span class="fas fa-file-upload"></span>
Import data from SPSS/SAS/Stata Import data from SPSS/SAS/Stata
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/EUCAST.html"> <a href="../articles/EUCAST.html">
<span class="fa fa-exchange-alt"></span> <span class="fas fa-exchange-alt"></span>
Apply EUCAST rules Apply EUCAST rules
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/mo_property.html"> <a href="../reference/mo_property.html">
<span class="fa fa-bug"></span> <span class="fas fa-bug"></span>
Get properties of a microorganism Get properties of a microorganism
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/ab_property.html"> <a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span> <span class="fas fa-capsules"></span>
Get properties of an antibiotic Get properties of an antibiotic
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/benchmarks.html"> <a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span> <span class="fas fa-shipping-fast"></span>
Other: benchmarks Other: benchmarks
</a> </a>
@ -185,21 +185,21 @@
</li> </li>
<li> <li>
<a href="../reference/index.html"> <a href="../reference/index.html">
<span class="fa fa-book-open"></span> <span class="fas fa-book-open"></span>
Manual Manual
</a> </a>
</li> </li>
<li> <li>
<a href="../authors.html"> <a href="../authors.html">
<span class="fa fa-users"></span> <span class="fas fa-users"></span>
Authors Authors
</a> </a>
</li> </li>
<li> <li>
<a href="../news/index.html"> <a href="../news/index.html">
<span class="far fa far fa-newspaper"></span> <span class="far fa-newspaper"></span>
Changelog Changelog
</a> </a>
@ -208,14 +208,14 @@
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li> <li>
<a href="https://github.com/msberends/AMR"> <a href="https://github.com/msberends/AMR">
<span class="fab fa fab fa-github"></span> <span class="fab fa-github"></span>
Source Code Source Code
</a> </a>
</li> </li>
<li> <li>
<a href="../survey.html"> <a href="../survey.html">
<span class="fa fa-clipboard-list"></span> <span class="fas fa-clipboard-list"></span>
Survey Survey
</a> </a>
@ -274,13 +274,14 @@
<p>All entries in the <a href='antibiotics.html'>antibiotics</a> data set have three different identifiers: a human readable EARS-Net code (column <code>ab</code>, used by ECDC and WHONET), an ATC code (column <code>atc</code>, used by WHO), and a CID code (column <code>cid</code>, Compound ID, used by PubChem). The data set contains more than 5,000 official brand names from many different countries, as found in PubChem.</p> <p>All entries in the <a href='antibiotics.html'>antibiotics</a> data set have three different identifiers: a human readable EARS-Net code (column <code>ab</code>, used by ECDC and WHONET), an ATC code (column <code>atc</code>, used by WHO), and a CID code (column <code>cid</code>, Compound ID, used by PubChem). The data set contains more than 5,000 official brand names from many different countries, as found in PubChem.</p>
<p>All these properties will be searched for the user input. The <code>as.ab()</code> can correct for different forms of misspelling:</p><ul> <p>All these properties will be searched for the user input. The <code>as.ab()</code> can correct for different forms of misspelling:</p><ul>
<li><p>Wrong spelling of drug names (like "tobramicin" or "gentamycin"), which corrects for most audible similarities such as f/ph, x/ks, c/z/s, t/th, etc.</p></li> <li><p>Wrong spelling of drug names (such as "tobramicin" or "gentamycin"), which corrects for most audible similarities such as f/ph, x/ks, c/z/s, t/th, etc.</p></li>
<li><p>Too few or too many vowels or consonants</p></li> <li><p>Too few or too many vowels or consonants</p></li>
<li><p>Switching two characters (like "mreopenem", often the case in clinical data, when doctors typed too fast)</p></li> <li><p>Switching two characters (such as "mreopenem", often the case in clinical data, when doctors typed too fast)</p></li>
<li><p>Digitalised paper records, leaving artefacts like 0/o/O (zero and O's), B/8, n/r, etc.</p></li> <li><p>Digitalised paper records, leaving artefacts like 0/o/O (zero and O's), B/8, n/r, etc.</p></li>
</ul> </ul>
<p>Use the <code><a href='ab_property.html'>ab_property()</a></code> functions to get properties based on the returned antibiotic ID, see Examples.</p> <p>Use the <code><a href='ab_property.html'>ab_*</a></code> functions to get properties based on the returned antibiotic ID, see Examples.</p>
<p>Note: the <code>as.ab()</code> and <code><a href='ab_property.html'>ab_*</a></code> functions may use very long regular expression to match brand names of antimicrobial agents. This may fail on some systems.</p>
<h2 class="hasAnchor" id="source"><a class="anchor" href="#source"></a>Source</h2> <h2 class="hasAnchor" id="source"><a class="anchor" href="#source"></a>Source</h2>

View File

@ -49,7 +49,7 @@
<script src="../extra.js"></script> <script src="../extra.js"></script>
<meta property="og:title" content="Transform input to a microorganism ID — as.mo" /> <meta property="og:title" content="Transform input to a microorganism ID — as.mo" />
<meta property="og:description" content="Use this function to determine a valid microorganism ID (mo). Determination is done using intelligent rules and the complete taxonomic kingdoms Bacteria, Chromista, Protozoa, Archaea and most microbial species from the kingdom Fungi (see Source). The input can be almost anything: a full name (like &quot;Staphylococcus aureus&quot;), an abbreviated name (like &quot;S. aureus&quot;), an abbreviation known in the field (like &quot;MRSA&quot;), or just a genus. Please see Examples." /> <meta property="og:description" content="Use this function to determine a valid microorganism ID (mo). Determination is done using intelligent rules and the complete taxonomic kingdoms Bacteria, Chromista, Protozoa, Archaea and most microbial species from the kingdom Fungi (see Source). The input can be almost anything: a full name (like &quot;Staphylococcus aureus&quot;), an abbreviated name (such as &quot;S. aureus&quot;), an abbreviation known in the field (such as &quot;MRSA&quot;), or just a genus. Please see Examples." />
<meta property="og:image" content="https://msberends.github.io/AMR/logo.png" /> <meta property="og:image" content="https://msberends.github.io/AMR/logo.png" />
@ -82,7 +82,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9034</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9041</span>
</span> </span>
</div> </div>
@ -90,14 +90,14 @@
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li> <li>
<a href="../index.html"> <a href="../index.html">
<span class="fa fa-home"></span> <span class="fas fa-home"></span>
Home Home
</a> </a>
</li> </li>
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<span class="fa fa-question-circle"></span> <span class="fas fa-question-circle"></span>
How to How to
@ -106,77 +106,77 @@
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
<li> <li>
<a href="../articles/AMR.html"> <a href="../articles/AMR.html">
<span class="fa fa-directions"></span> <span class="fas fa-directions"></span>
Conduct AMR analysis Conduct AMR analysis
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/resistance_predict.html"> <a href="../articles/resistance_predict.html">
<span class="fa fa-dice"></span> <span class="fas fa-dice"></span>
Predict antimicrobial resistance Predict antimicrobial resistance
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/datasets.html"> <a href="../articles/datasets.html">
<span class="fa fa-database"></span> <span class="fas fa-database"></span>
Data sets for download / own use Data sets for download / own use
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/PCA.html"> <a href="../articles/PCA.html">
<span class="fa fa-compress"></span> <span class="fas fa-compress"></span>
Conduct principal component analysis for AMR Conduct principal component analysis for AMR
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/MDR.html"> <a href="../articles/MDR.html">
<span class="fa fa-skull-crossbones"></span> <span class="fas fa-skull-crossbones"></span>
Determine multi-drug resistance (MDR) Determine multi-drug resistance (MDR)
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/WHONET.html"> <a href="../articles/WHONET.html">
<span class="fa fa-globe-americas"></span> <span class="fas fa-globe-americas"></span>
Work with WHONET data Work with WHONET data
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/SPSS.html"> <a href="../articles/SPSS.html">
<span class="fa fa-file-upload"></span> <span class="fas fa-file-upload"></span>
Import data from SPSS/SAS/Stata Import data from SPSS/SAS/Stata
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/EUCAST.html"> <a href="../articles/EUCAST.html">
<span class="fa fa-exchange-alt"></span> <span class="fas fa-exchange-alt"></span>
Apply EUCAST rules Apply EUCAST rules
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/mo_property.html"> <a href="../reference/mo_property.html">
<span class="fa fa-bug"></span> <span class="fas fa-bug"></span>
Get properties of a microorganism Get properties of a microorganism
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/ab_property.html"> <a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span> <span class="fas fa-capsules"></span>
Get properties of an antibiotic Get properties of an antibiotic
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/benchmarks.html"> <a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span> <span class="fas fa-shipping-fast"></span>
Other: benchmarks Other: benchmarks
</a> </a>
@ -185,21 +185,21 @@
</li> </li>
<li> <li>
<a href="../reference/index.html"> <a href="../reference/index.html">
<span class="fa fa-book-open"></span> <span class="fas fa-book-open"></span>
Manual Manual
</a> </a>
</li> </li>
<li> <li>
<a href="../authors.html"> <a href="../authors.html">
<span class="fa fa-users"></span> <span class="fas fa-users"></span>
Authors Authors
</a> </a>
</li> </li>
<li> <li>
<a href="../news/index.html"> <a href="../news/index.html">
<span class="far fa far fa-newspaper"></span> <span class="far fa-newspaper"></span>
Changelog Changelog
</a> </a>
@ -208,14 +208,14 @@
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li> <li>
<a href="https://github.com/msberends/AMR"> <a href="https://github.com/msberends/AMR">
<span class="fab fa fab fa-github"></span> <span class="fab fa-github"></span>
Source Code Source Code
</a> </a>
</li> </li>
<li> <li>
<a href="../survey.html"> <a href="../survey.html">
<span class="fa fa-clipboard-list"></span> <span class="fas fa-clipboard-list"></span>
Survey Survey
</a> </a>
@ -239,7 +239,7 @@
</div> </div>
<div class="ref-description"> <div class="ref-description">
<p>Use this function to determine a valid microorganism ID (<code>mo</code>). Determination is done using intelligent rules and the complete taxonomic kingdoms Bacteria, Chromista, Protozoa, Archaea and most microbial species from the kingdom Fungi (see Source). The input can be almost anything: a full name (like <code>"Staphylococcus aureus"</code>), an abbreviated name (like <code>"S. aureus"</code>), an abbreviation known in the field (like <code>"MRSA"</code>), or just a genus. Please see <em>Examples</em>.</p> <p>Use this function to determine a valid microorganism ID (<code>mo</code>). Determination is done using intelligent rules and the complete taxonomic kingdoms Bacteria, Chromista, Protozoa, Archaea and most microbial species from the kingdom Fungi (see Source). The input can be almost anything: a full name (like <code>"Staphylococcus aureus"</code>), an abbreviated name (such as <code>"S. aureus"</code>), an abbreviation known in the field (such as <code>"MRSA"</code>), or just a genus. Please see <em>Examples</em>.</p>
</div> </div>
<pre class="usage"><span class='fu'>as.mo</span><span class='op'>(</span> <pre class="usage"><span class='fu'>as.mo</span><span class='op'>(</span>
@ -419,7 +419,7 @@ This package contains the complete taxonomic tree of almost all microorganisms (
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2> <h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p><a href='microorganisms.html'>microorganisms</a> for the <a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a> that is being used to determine ID's.</p> <div class='dont-index'><p><a href='microorganisms.html'>microorganisms</a> for the <a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a> that is being used to determine ID's.</p>
<p>The <code><a href='mo_property.html'>mo_property()</a></code> functions (like <code><a href='mo_property.html'>mo_genus()</a></code>, <code><a href='mo_property.html'>mo_gramstain()</a></code>) to get properties based on the returned code.</p></div> <p>The <code><a href='mo_property.html'>mo_*</a></code> functions (such as <code><a href='mo_property.html'>mo_genus()</a></code>, <code><a href='mo_property.html'>mo_gramstain()</a></code>) to get properties based on the returned code.</p></div>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2> <h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><span class='co'># \donttest{</span> <pre class="examples"><span class='co'># \donttest{</span>

View File

@ -82,7 +82,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9032</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9041</span>
</span> </span>
</div> </div>
@ -90,14 +90,14 @@
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li> <li>
<a href="../index.html"> <a href="../index.html">
<span class="fa fa-home"></span> <span class="fas fa-home"></span>
Home Home
</a> </a>
</li> </li>
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<span class="fa fa-question-circle"></span> <span class="fas fa-question-circle"></span>
How to How to
@ -106,77 +106,77 @@
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
<li> <li>
<a href="../articles/AMR.html"> <a href="../articles/AMR.html">
<span class="fa fa-directions"></span> <span class="fas fa-directions"></span>
Conduct AMR analysis Conduct AMR analysis
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/resistance_predict.html"> <a href="../articles/resistance_predict.html">
<span class="fa fa-dice"></span> <span class="fas fa-dice"></span>
Predict antimicrobial resistance Predict antimicrobial resistance
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/datasets.html"> <a href="../articles/datasets.html">
<span class="fa fa-database"></span> <span class="fas fa-database"></span>
Data sets for download / own use Data sets for download / own use
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/PCA.html"> <a href="../articles/PCA.html">
<span class="fa fa-compress"></span> <span class="fas fa-compress"></span>
Conduct principal component analysis for AMR Conduct principal component analysis for AMR
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/MDR.html"> <a href="../articles/MDR.html">
<span class="fa fa-skull-crossbones"></span> <span class="fas fa-skull-crossbones"></span>
Determine multi-drug resistance (MDR) Determine multi-drug resistance (MDR)
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/WHONET.html"> <a href="../articles/WHONET.html">
<span class="fa fa-globe-americas"></span> <span class="fas fa-globe-americas"></span>
Work with WHONET data Work with WHONET data
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/SPSS.html"> <a href="../articles/SPSS.html">
<span class="fa fa-file-upload"></span> <span class="fas fa-file-upload"></span>
Import data from SPSS/SAS/Stata Import data from SPSS/SAS/Stata
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/EUCAST.html"> <a href="../articles/EUCAST.html">
<span class="fa fa-exchange-alt"></span> <span class="fas fa-exchange-alt"></span>
Apply EUCAST rules Apply EUCAST rules
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/mo_property.html"> <a href="../reference/mo_property.html">
<span class="fa fa-bug"></span> <span class="fas fa-bug"></span>
Get properties of a microorganism Get properties of a microorganism
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/ab_property.html"> <a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span> <span class="fas fa-capsules"></span>
Get properties of an antibiotic Get properties of an antibiotic
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/benchmarks.html"> <a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span> <span class="fas fa-shipping-fast"></span>
Other: benchmarks Other: benchmarks
</a> </a>
@ -185,21 +185,21 @@
</li> </li>
<li> <li>
<a href="../reference/index.html"> <a href="../reference/index.html">
<span class="fa fa-book-open"></span> <span class="fas fa-book-open"></span>
Manual Manual
</a> </a>
</li> </li>
<li> <li>
<a href="../authors.html"> <a href="../authors.html">
<span class="fa fa-users"></span> <span class="fas fa-users"></span>
Authors Authors
</a> </a>
</li> </li>
<li> <li>
<a href="../news/index.html"> <a href="../news/index.html">
<span class="far fa far fa-newspaper"></span> <span class="far fa-newspaper"></span>
Changelog Changelog
</a> </a>
@ -208,14 +208,14 @@
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li> <li>
<a href="https://github.com/msberends/AMR"> <a href="https://github.com/msberends/AMR">
<span class="fab fa fab fa-github"></span> <span class="fab fa-github"></span>
Source Code Source Code
</a> </a>
</li> </li>
<li> <li>
<a href="../survey.html"> <a href="../survey.html">
<span class="fa fa-clipboard-list"></span> <span class="fas fa-clipboard-list"></span>
Survey Survey
</a> </a>
@ -292,7 +292,7 @@
</tr> </tr>
<tr> <tr>
<th>combine_SI</th> <th>combine_SI</th>
<td><p>a logical to indicate whether all values of S and I must be merged into one, so the output only consists of S+I vs. R (susceptible vs. resistant). This used to be the parameter <code>combine_IR</code>, but this now follows the redefinition by EUCAST about the interpretion of I (increased exposure) in 2019, see section 'Interpretation of S, I and R' below. Default is <code>TRUE</code>.</p></td> <td><p>a logical to indicate whether all values of S and I must be merged into one, so the output only consists of S+I vs. R (susceptible vs. resistant). This used to be the parameter <code>combine_IR</code>, but this now follows the redefinition by EUCAST about the interpretation of I (increased exposure) in 2019, see section 'Interpretation of S, I and R' below. Default is <code>TRUE</code>.</p></td>
</tr> </tr>
<tr> <tr>
<th>combine_IR</th> <th>combine_IR</th>

View File

@ -82,7 +82,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9034</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9041</span>
</span> </span>
</div> </div>
@ -90,14 +90,14 @@
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li> <li>
<a href="../index.html"> <a href="../index.html">
<span class="fa fa-home"></span> <span class="fas fa-home"></span>
Home Home
</a> </a>
</li> </li>
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<span class="fa fa-question-circle"></span> <span class="fas fa-question-circle"></span>
How to How to
@ -106,77 +106,77 @@
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
<li> <li>
<a href="../articles/AMR.html"> <a href="../articles/AMR.html">
<span class="fa fa-directions"></span> <span class="fas fa-directions"></span>
Conduct AMR analysis Conduct AMR analysis
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/resistance_predict.html"> <a href="../articles/resistance_predict.html">
<span class="fa fa-dice"></span> <span class="fas fa-dice"></span>
Predict antimicrobial resistance Predict antimicrobial resistance
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/datasets.html"> <a href="../articles/datasets.html">
<span class="fa fa-database"></span> <span class="fas fa-database"></span>
Data sets for download / own use Data sets for download / own use
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/PCA.html"> <a href="../articles/PCA.html">
<span class="fa fa-compress"></span> <span class="fas fa-compress"></span>
Conduct principal component analysis for AMR Conduct principal component analysis for AMR
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/MDR.html"> <a href="../articles/MDR.html">
<span class="fa fa-skull-crossbones"></span> <span class="fas fa-skull-crossbones"></span>
Determine multi-drug resistance (MDR) Determine multi-drug resistance (MDR)
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/WHONET.html"> <a href="../articles/WHONET.html">
<span class="fa fa-globe-americas"></span> <span class="fas fa-globe-americas"></span>
Work with WHONET data Work with WHONET data
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/SPSS.html"> <a href="../articles/SPSS.html">
<span class="fa fa-file-upload"></span> <span class="fas fa-file-upload"></span>
Import data from SPSS/SAS/Stata Import data from SPSS/SAS/Stata
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/EUCAST.html"> <a href="../articles/EUCAST.html">
<span class="fa fa-exchange-alt"></span> <span class="fas fa-exchange-alt"></span>
Apply EUCAST rules Apply EUCAST rules
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/mo_property.html"> <a href="../reference/mo_property.html">
<span class="fa fa-bug"></span> <span class="fas fa-bug"></span>
Get properties of a microorganism Get properties of a microorganism
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/ab_property.html"> <a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span> <span class="fas fa-capsules"></span>
Get properties of an antibiotic Get properties of an antibiotic
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/benchmarks.html"> <a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span> <span class="fas fa-shipping-fast"></span>
Other: benchmarks Other: benchmarks
</a> </a>
@ -185,21 +185,21 @@
</li> </li>
<li> <li>
<a href="../reference/index.html"> <a href="../reference/index.html">
<span class="fa fa-book-open"></span> <span class="fas fa-book-open"></span>
Manual Manual
</a> </a>
</li> </li>
<li> <li>
<a href="../authors.html"> <a href="../authors.html">
<span class="fa fa-users"></span> <span class="fas fa-users"></span>
Authors Authors
</a> </a>
</li> </li>
<li> <li>
<a href="../news/index.html"> <a href="../news/index.html">
<span class="far fa far fa-newspaper"></span> <span class="far fa-newspaper"></span>
Changelog Changelog
</a> </a>
@ -208,14 +208,14 @@
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li> <li>
<a href="https://github.com/msberends/AMR"> <a href="https://github.com/msberends/AMR">
<span class="fab fa fab fa-github"></span> <span class="fab fa-github"></span>
Source Code Source Code
</a> </a>
</li> </li>
<li> <li>
<a href="../survey.html"> <a href="../survey.html">
<span class="fa fa-clipboard-list"></span> <span class="fas fa-clipboard-list"></span>
Survey Survey
</a> </a>
@ -257,8 +257,8 @@ This package contains the complete taxonomic tree of almost all microorganisms (
<p>Included are:</p><ul> <p>Included are:</p><ul>
<li><p>All ~55,000 (sub)species from the kingdoms of Archaea, Bacteria, Chromista and Protozoa</p></li> <li><p>All ~55,000 (sub)species from the kingdoms of Archaea, Bacteria, Chromista and Protozoa</p></li>
<li><p>All ~5,000 (sub)species from these orders of the kingdom of Fungi: Eurotiales, Microascales, Mucorales, Onygenales, Pneumocystales, Saccharomycetales, Schizosaccharomycetales and Tremellales, as well as ~4,600 other fungal (sub)species. The kingdom of Fungi is a very large taxon with almost 300,000 different (sub)species, of which most are not microbial (but rather macroscopic, like mushrooms). Because of this, not all fungi fit the scope of this package and including everything would tremendously slow down our algorithms too. By only including the aforementioned taxonomic orders, the most relevant fungi are covered (like all species of <em>Aspergillus</em>, <em>Candida</em>, <em>Cryptococcus</em>, <em>Histplasma</em>, <em>Pneumocystis</em>, <em>Saccharomyces</em> and <em>Trichophyton</em>).</p></li> <li><p>All ~5,000 (sub)species from these orders of the kingdom of Fungi: Eurotiales, Microascales, Mucorales, Onygenales, Pneumocystales, Saccharomycetales, Schizosaccharomycetales and Tremellales, as well as ~4,600 other fungal (sub)species. The kingdom of Fungi is a very large taxon with almost 300,000 different (sub)species, of which most are not microbial (but rather macroscopic, like mushrooms). Because of this, not all fungi fit the scope of this package and including everything would tremendously slow down our algorithms too. By only including the aforementioned taxonomic orders, the most relevant fungi are covered (such as all species of <em>Aspergillus</em>, <em>Candida</em>, <em>Cryptococcus</em>, <em>Histplasma</em>, <em>Pneumocystis</em>, <em>Saccharomyces</em> and <em>Trichophyton</em>).</p></li>
<li><p>All ~2,200 (sub)species from ~50 other relevant genera from the kingdom of Animalia (like <em>Strongyloides</em> and <em>Taenia</em>)</p></li> <li><p>All ~2,200 (sub)species from ~50 other relevant genera from the kingdom of Animalia (such as <em>Strongyloides</em> and <em>Taenia</em>)</p></li>
<li><p>All ~13,000 previously accepted names of all included (sub)species (these were taxonomically renamed)</p></li> <li><p>All ~13,000 previously accepted names of all included (sub)species (these were taxonomically renamed)</p></li>
<li><p>The complete taxonomic tree of all included (sub)species: from kingdom to subspecies</p></li> <li><p>The complete taxonomic tree of all included (sub)species: from kingdom to subspecies</p></li>
<li><p>The responsible author(s) and year of scientific publication</p></li> <li><p>The responsible author(s) and year of scientific publication</p></li>

View File

@ -83,7 +83,7 @@ count_resistant() should be used to count resistant isolates, count_susceptible(
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9032</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9041</span>
</span> </span>
</div> </div>
@ -91,14 +91,14 @@ count_resistant() should be used to count resistant isolates, count_susceptible(
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li> <li>
<a href="../index.html"> <a href="../index.html">
<span class="fa fa-home"></span> <span class="fas fa-home"></span>
Home Home
</a> </a>
</li> </li>
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<span class="fa fa-question-circle"></span> <span class="fas fa-question-circle"></span>
How to How to
@ -107,77 +107,77 @@ count_resistant() should be used to count resistant isolates, count_susceptible(
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
<li> <li>
<a href="../articles/AMR.html"> <a href="../articles/AMR.html">
<span class="fa fa-directions"></span> <span class="fas fa-directions"></span>
Conduct AMR analysis Conduct AMR analysis
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/resistance_predict.html"> <a href="../articles/resistance_predict.html">
<span class="fa fa-dice"></span> <span class="fas fa-dice"></span>
Predict antimicrobial resistance Predict antimicrobial resistance
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/datasets.html"> <a href="../articles/datasets.html">
<span class="fa fa-database"></span> <span class="fas fa-database"></span>
Data sets for download / own use Data sets for download / own use
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/PCA.html"> <a href="../articles/PCA.html">
<span class="fa fa-compress"></span> <span class="fas fa-compress"></span>
Conduct principal component analysis for AMR Conduct principal component analysis for AMR
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/MDR.html"> <a href="../articles/MDR.html">
<span class="fa fa-skull-crossbones"></span> <span class="fas fa-skull-crossbones"></span>
Determine multi-drug resistance (MDR) Determine multi-drug resistance (MDR)
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/WHONET.html"> <a href="../articles/WHONET.html">
<span class="fa fa-globe-americas"></span> <span class="fas fa-globe-americas"></span>
Work with WHONET data Work with WHONET data
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/SPSS.html"> <a href="../articles/SPSS.html">
<span class="fa fa-file-upload"></span> <span class="fas fa-file-upload"></span>
Import data from SPSS/SAS/Stata Import data from SPSS/SAS/Stata
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/EUCAST.html"> <a href="../articles/EUCAST.html">
<span class="fa fa-exchange-alt"></span> <span class="fas fa-exchange-alt"></span>
Apply EUCAST rules Apply EUCAST rules
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/mo_property.html"> <a href="../reference/mo_property.html">
<span class="fa fa-bug"></span> <span class="fas fa-bug"></span>
Get properties of a microorganism Get properties of a microorganism
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/ab_property.html"> <a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span> <span class="fas fa-capsules"></span>
Get properties of an antibiotic Get properties of an antibiotic
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/benchmarks.html"> <a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span> <span class="fas fa-shipping-fast"></span>
Other: benchmarks Other: benchmarks
</a> </a>
@ -186,21 +186,21 @@ count_resistant() should be used to count resistant isolates, count_susceptible(
</li> </li>
<li> <li>
<a href="../reference/index.html"> <a href="../reference/index.html">
<span class="fa fa-book-open"></span> <span class="fas fa-book-open"></span>
Manual Manual
</a> </a>
</li> </li>
<li> <li>
<a href="../authors.html"> <a href="../authors.html">
<span class="fa fa-users"></span> <span class="fas fa-users"></span>
Authors Authors
</a> </a>
</li> </li>
<li> <li>
<a href="../news/index.html"> <a href="../news/index.html">
<span class="far fa far fa-newspaper"></span> <span class="far fa-newspaper"></span>
Changelog Changelog
</a> </a>
@ -209,14 +209,14 @@ count_resistant() should be used to count resistant isolates, count_susceptible(
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li> <li>
<a href="https://github.com/msberends/AMR"> <a href="https://github.com/msberends/AMR">
<span class="fab fa fab fa-github"></span> <span class="fab fa-github"></span>
Source Code Source Code
</a> </a>
</li> </li>
<li> <li>
<a href="../survey.html"> <a href="../survey.html">
<span class="fa fa-clipboard-list"></span> <span class="fas fa-clipboard-list"></span>
Survey Survey
</a> </a>
@ -287,7 +287,7 @@ count_resistant() should be used to count resistant isolates, count_susceptible(
</tr> </tr>
<tr> <tr>
<th>translate_ab</th> <th>translate_ab</th>
<td><p>a column name of the <a href='antibiotics.html'>antibiotics</a> data set to translate the antibiotic abbreviations to, using <code><a href='ab_property.html'>ab_property()</a></code>. Use a value</p></td> <td><p>a column name of the <a href='antibiotics.html'>antibiotics</a> data set to translate the antibiotic abbreviations to, using <code><a href='ab_property.html'>ab_property()</a></code></p></td>
</tr> </tr>
<tr> <tr>
<th>language</th> <th>language</th>
@ -295,7 +295,7 @@ count_resistant() should be used to count resistant isolates, count_susceptible(
</tr> </tr>
<tr> <tr>
<th>combine_SI</th> <th>combine_SI</th>
<td><p>a logical to indicate whether all values of S and I must be merged into one, so the output only consists of S+I vs. R (susceptible vs. resistant). This used to be the parameter <code>combine_IR</code>, but this now follows the redefinition by EUCAST about the interpretion of I (increased exposure) in 2019, see section 'Interpretation of S, I and R' below. Default is <code>TRUE</code>.</p></td> <td><p>a logical to indicate whether all values of S and I must be merged into one, so the output only consists of S+I vs. R (susceptible vs. resistant). This used to be the parameter <code>combine_IR</code>, but this now follows the redefinition by EUCAST about the interpretation of I (increased exposure) in 2019, see section 'Interpretation of S, I and R' below. Default is <code>TRUE</code>.</p></td>
</tr> </tr>
<tr> <tr>
<th>combine_IR</th> <th>combine_IR</th>

View File

@ -82,7 +82,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9034</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9041</span>
</span> </span>
</div> </div>
@ -90,14 +90,14 @@
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li> <li>
<a href="../index.html"> <a href="../index.html">
<span class="fa fa-home"></span> <span class="fas fa-home"></span>
Home Home
</a> </a>
</li> </li>
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<span class="fa fa-question-circle"></span> <span class="fas fa-question-circle"></span>
How to How to
@ -106,77 +106,77 @@
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
<li> <li>
<a href="../articles/AMR.html"> <a href="../articles/AMR.html">
<span class="fa fa-directions"></span> <span class="fas fa-directions"></span>
Conduct AMR analysis Conduct AMR analysis
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/resistance_predict.html"> <a href="../articles/resistance_predict.html">
<span class="fa fa-dice"></span> <span class="fas fa-dice"></span>
Predict antimicrobial resistance Predict antimicrobial resistance
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/datasets.html"> <a href="../articles/datasets.html">
<span class="fa fa-database"></span> <span class="fas fa-database"></span>
Data sets for download / own use Data sets for download / own use
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/PCA.html"> <a href="../articles/PCA.html">
<span class="fa fa-compress"></span> <span class="fas fa-compress"></span>
Conduct principal component analysis for AMR Conduct principal component analysis for AMR
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/MDR.html"> <a href="../articles/MDR.html">
<span class="fa fa-skull-crossbones"></span> <span class="fas fa-skull-crossbones"></span>
Determine multi-drug resistance (MDR) Determine multi-drug resistance (MDR)
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/WHONET.html"> <a href="../articles/WHONET.html">
<span class="fa fa-globe-americas"></span> <span class="fas fa-globe-americas"></span>
Work with WHONET data Work with WHONET data
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/SPSS.html"> <a href="../articles/SPSS.html">
<span class="fa fa-file-upload"></span> <span class="fas fa-file-upload"></span>
Import data from SPSS/SAS/Stata Import data from SPSS/SAS/Stata
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/EUCAST.html"> <a href="../articles/EUCAST.html">
<span class="fa fa-exchange-alt"></span> <span class="fas fa-exchange-alt"></span>
Apply EUCAST rules Apply EUCAST rules
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/mo_property.html"> <a href="../reference/mo_property.html">
<span class="fa fa-bug"></span> <span class="fas fa-bug"></span>
Get properties of a microorganism Get properties of a microorganism
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/ab_property.html"> <a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span> <span class="fas fa-capsules"></span>
Get properties of an antibiotic Get properties of an antibiotic
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/benchmarks.html"> <a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span> <span class="fas fa-shipping-fast"></span>
Other: benchmarks Other: benchmarks
</a> </a>
@ -185,21 +185,21 @@
</li> </li>
<li> <li>
<a href="../reference/index.html"> <a href="../reference/index.html">
<span class="fa fa-book-open"></span> <span class="fas fa-book-open"></span>
Manual Manual
</a> </a>
</li> </li>
<li> <li>
<a href="../authors.html"> <a href="../authors.html">
<span class="fa fa-users"></span> <span class="fas fa-users"></span>
Authors Authors
</a> </a>
</li> </li>
<li> <li>
<a href="../news/index.html"> <a href="../news/index.html">
<span class="far fa far fa-newspaper"></span> <span class="far fa-newspaper"></span>
Changelog Changelog
</a> </a>
@ -208,14 +208,14 @@
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li> <li>
<a href="https://github.com/msberends/AMR"> <a href="https://github.com/msberends/AMR">
<span class="fab fa fab fa-github"></span> <span class="fab fa-github"></span>
Source Code Source Code
</a> </a>
</li> </li>
<li> <li>
<a href="../survey.html"> <a href="../survey.html">
<span class="fa fa-clipboard-list"></span> <span class="fas fa-clipboard-list"></span>
Survey Survey
</a> </a>
@ -301,7 +301,7 @@
</tr> </tr>
<tr> <tr>
<th>col_testcode</th> <th>col_testcode</th>
<td><p>column name of the test codes. Use <code>col_testcode = NULL</code> to <strong>not</strong> exclude certain test codes (like test codes for screening). In that case <code>testcodes_exclude</code> will be ignored.</p></td> <td><p>column name of the test codes. Use <code>col_testcode = NULL</code> to <strong>not</strong> exclude certain test codes (such as test codes for screening). In that case <code>testcodes_exclude</code> will be ignored.</p></td>
</tr> </tr>
<tr> <tr>
<th>col_specimen</th> <th>col_specimen</th>

View File

@ -82,7 +82,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9032</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9041</span>
</span> </span>
</div> </div>
@ -90,14 +90,14 @@
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li> <li>
<a href="../index.html"> <a href="../index.html">
<span class="fa fa-home"></span> <span class="fas fa-home"></span>
Home Home
</a> </a>
</li> </li>
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<span class="fa fa-question-circle"></span> <span class="fas fa-question-circle"></span>
How to How to
@ -106,77 +106,77 @@
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
<li> <li>
<a href="../articles/AMR.html"> <a href="../articles/AMR.html">
<span class="fa fa-directions"></span> <span class="fas fa-directions"></span>
Conduct AMR analysis Conduct AMR analysis
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/resistance_predict.html"> <a href="../articles/resistance_predict.html">
<span class="fa fa-dice"></span> <span class="fas fa-dice"></span>
Predict antimicrobial resistance Predict antimicrobial resistance
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/datasets.html"> <a href="../articles/datasets.html">
<span class="fa fa-database"></span> <span class="fas fa-database"></span>
Data sets for download / own use Data sets for download / own use
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/PCA.html"> <a href="../articles/PCA.html">
<span class="fa fa-compress"></span> <span class="fas fa-compress"></span>
Conduct principal component analysis for AMR Conduct principal component analysis for AMR
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/MDR.html"> <a href="../articles/MDR.html">
<span class="fa fa-skull-crossbones"></span> <span class="fas fa-skull-crossbones"></span>
Determine multi-drug resistance (MDR) Determine multi-drug resistance (MDR)
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/WHONET.html"> <a href="../articles/WHONET.html">
<span class="fa fa-globe-americas"></span> <span class="fas fa-globe-americas"></span>
Work with WHONET data Work with WHONET data
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/SPSS.html"> <a href="../articles/SPSS.html">
<span class="fa fa-file-upload"></span> <span class="fas fa-file-upload"></span>
Import data from SPSS/SAS/Stata Import data from SPSS/SAS/Stata
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/EUCAST.html"> <a href="../articles/EUCAST.html">
<span class="fa fa-exchange-alt"></span> <span class="fas fa-exchange-alt"></span>
Apply EUCAST rules Apply EUCAST rules
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/mo_property.html"> <a href="../reference/mo_property.html">
<span class="fa fa-bug"></span> <span class="fas fa-bug"></span>
Get properties of a microorganism Get properties of a microorganism
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/ab_property.html"> <a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span> <span class="fas fa-capsules"></span>
Get properties of an antibiotic Get properties of an antibiotic
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/benchmarks.html"> <a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span> <span class="fas fa-shipping-fast"></span>
Other: benchmarks Other: benchmarks
</a> </a>
@ -185,21 +185,21 @@
</li> </li>
<li> <li>
<a href="../reference/index.html"> <a href="../reference/index.html">
<span class="fa fa-book-open"></span> <span class="fas fa-book-open"></span>
Manual Manual
</a> </a>
</li> </li>
<li> <li>
<a href="../authors.html"> <a href="../authors.html">
<span class="fa fa-users"></span> <span class="fas fa-users"></span>
Authors Authors
</a> </a>
</li> </li>
<li> <li>
<a href="../news/index.html"> <a href="../news/index.html">
<span class="far fa far fa-newspaper"></span> <span class="far fa-newspaper"></span>
Changelog Changelog
</a> </a>
@ -208,14 +208,14 @@
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li> <li>
<a href="https://github.com/msberends/AMR"> <a href="https://github.com/msberends/AMR">
<span class="fab fa fab fa-github"></span> <span class="fab fa-github"></span>
Source Code Source Code
</a> </a>
</li> </li>
<li> <li>
<a href="../survey.html"> <a href="../survey.html">
<span class="fa fa-clipboard-list"></span> <span class="fas fa-clipboard-list"></span>
Survey Survey
</a> </a>
@ -304,7 +304,7 @@
<p>If <code>x</code> is a matrix with one row or column, or if <code>x</code> is a vector and <code>y</code> is not given, then a <em>goodness-of-fit test</em> is performed (<code>x</code> is treated as a one-dimensional contingency table). The entries of <code>x</code> must be non-negative integers. In this case, the hypothesis tested is whether the population probabilities equal those in <code>p</code>, or are all equal if <code>p</code> is not given.</p> <p>If <code>x</code> is a matrix with one row or column, or if <code>x</code> is a vector and <code>y</code> is not given, then a <em>goodness-of-fit test</em> is performed (<code>x</code> is treated as a one-dimensional contingency table). The entries of <code>x</code> must be non-negative integers. In this case, the hypothesis tested is whether the population probabilities equal those in <code>p</code>, or are all equal if <code>p</code> is not given.</p>
<p>If <code>x</code> is a matrix with at least two rows and columns, it is taken as a two-dimensional contingency table: the entries of <code>x</code> must be non-negative integers. Otherwise, <code>x</code> and <code>y</code> must be vectors or factors of the same length; cases with missing values are removed, the objects are coerced to factors, and the contingency table is computed from these. Then Pearson's chi-squared test is performed of the null hypothesis that the joint distribution of the cell counts in a 2-dimensional contingency table is the product of the row and column marginals.</p> <p>If <code>x</code> is a matrix with at least two rows and columns, it is taken as a two-dimensional contingency table: the entries of <code>x</code> must be non-negative integers. Otherwise, <code>x</code> and <code>y</code> must be vectors or factors of the same length; cases with missing values are removed, the objects are coerced to factors, and the contingency table is computed from these. Then Pearson's chi-squared test is performed of the null hypothesis that the joint distribution of the cell counts in a 2-dimensional contingency table is the product of the row and column marginals.</p>
<p>The p-value is computed from the asymptotic chi-squared distribution of the test statistic.</p> <p>The p-value is computed from the asymptotic chi-squared distribution of the test statistic.</p>
<p>In the contingency table case simulation is done by random sampling from the set of all contingency tables with given marginals, and works only if the marginals are strictly positive. Note that this is not the usual sampling situation assumed for a chi-squared test (like the <em>G</em>-test) but rather that for Fisher's exact test.</p> <p>In the contingency table case simulation is done by random sampling from the set of all contingency tables with given marginals, and works only if the marginals are strictly positive. Note that this is not the usual sampling situation assumed for a chi-squared test (such as the <em>G</em>-test) but rather that for Fisher's exact test.</p>
<p>In the goodness-of-fit case simulation is done by random sampling from the discrete distribution specified by <code>p</code>, each sample being of size <code>n = sum(x)</code>. This simulation is done in <span style="R">R</span> and may be slow.</p><h3 class='hasAnchor' id='arguments'><a class='anchor' href='#arguments'></a><em>G</em>-test of goodness-of-fit (likelihood ratio test)</h3> <p>In the goodness-of-fit case simulation is done by random sampling from the discrete distribution specified by <code>p</code>, each sample being of size <code>n = sum(x)</code>. This simulation is done in <span style="R">R</span> and may be slow.</p><h3 class='hasAnchor' id='arguments'><a class='anchor' href='#arguments'></a><em>G</em>-test of goodness-of-fit (likelihood ratio test)</h3>

View File

@ -82,7 +82,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9032</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9041</span>
</span> </span>
</div> </div>
@ -90,14 +90,14 @@
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li> <li>
<a href="../index.html"> <a href="../index.html">
<span class="fa fa-home"></span> <span class="fas fa-home"></span>
Home Home
</a> </a>
</li> </li>
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<span class="fa fa-question-circle"></span> <span class="fas fa-question-circle"></span>
How to How to
@ -106,77 +106,77 @@
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
<li> <li>
<a href="../articles/AMR.html"> <a href="../articles/AMR.html">
<span class="fa fa-directions"></span> <span class="fas fa-directions"></span>
Conduct AMR analysis Conduct AMR analysis
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/resistance_predict.html"> <a href="../articles/resistance_predict.html">
<span class="fa fa-dice"></span> <span class="fas fa-dice"></span>
Predict antimicrobial resistance Predict antimicrobial resistance
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/datasets.html"> <a href="../articles/datasets.html">
<span class="fa fa-database"></span> <span class="fas fa-database"></span>
Data sets for download / own use Data sets for download / own use
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/PCA.html"> <a href="../articles/PCA.html">
<span class="fa fa-compress"></span> <span class="fas fa-compress"></span>
Conduct principal component analysis for AMR Conduct principal component analysis for AMR
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/MDR.html"> <a href="../articles/MDR.html">
<span class="fa fa-skull-crossbones"></span> <span class="fas fa-skull-crossbones"></span>
Determine multi-drug resistance (MDR) Determine multi-drug resistance (MDR)
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/WHONET.html"> <a href="../articles/WHONET.html">
<span class="fa fa-globe-americas"></span> <span class="fas fa-globe-americas"></span>
Work with WHONET data Work with WHONET data
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/SPSS.html"> <a href="../articles/SPSS.html">
<span class="fa fa-file-upload"></span> <span class="fas fa-file-upload"></span>
Import data from SPSS/SAS/Stata Import data from SPSS/SAS/Stata
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/EUCAST.html"> <a href="../articles/EUCAST.html">
<span class="fa fa-exchange-alt"></span> <span class="fas fa-exchange-alt"></span>
Apply EUCAST rules Apply EUCAST rules
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/mo_property.html"> <a href="../reference/mo_property.html">
<span class="fa fa-bug"></span> <span class="fas fa-bug"></span>
Get properties of a microorganism Get properties of a microorganism
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/ab_property.html"> <a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span> <span class="fas fa-capsules"></span>
Get properties of an antibiotic Get properties of an antibiotic
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/benchmarks.html"> <a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span> <span class="fas fa-shipping-fast"></span>
Other: benchmarks Other: benchmarks
</a> </a>
@ -185,21 +185,21 @@
</li> </li>
<li> <li>
<a href="../reference/index.html"> <a href="../reference/index.html">
<span class="fa fa-book-open"></span> <span class="fas fa-book-open"></span>
Manual Manual
</a> </a>
</li> </li>
<li> <li>
<a href="../authors.html"> <a href="../authors.html">
<span class="fa fa-users"></span> <span class="fas fa-users"></span>
Authors Authors
</a> </a>
</li> </li>
<li> <li>
<a href="../news/index.html"> <a href="../news/index.html">
<span class="far fa far fa-newspaper"></span> <span class="far fa-newspaper"></span>
Changelog Changelog
</a> </a>
@ -208,14 +208,14 @@
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li> <li>
<a href="https://github.com/msberends/AMR"> <a href="https://github.com/msberends/AMR">
<span class="fab fa fab fa-github"></span> <span class="fab fa-github"></span>
Source Code Source Code
</a> </a>
</li> </li>
<li> <li>
<a href="../survey.html"> <a href="../survey.html">
<span class="fa fa-clipboard-list"></span> <span class="fas fa-clipboard-list"></span>
Survey Survey
</a> </a>
@ -337,11 +337,11 @@
</tr> </tr>
<tr> <tr>
<th>translate_ab</th> <th>translate_ab</th>
<td><p>a column name of the <a href='antibiotics.html'>antibiotics</a> data set to translate the antibiotic abbreviations to, using <code><a href='ab_property.html'>ab_property()</a></code>. Use a value</p></td> <td><p>a column name of the <a href='antibiotics.html'>antibiotics</a> data set to translate the antibiotic abbreviations to, using <code><a href='ab_property.html'>ab_property()</a></code></p></td>
</tr> </tr>
<tr> <tr>
<th>combine_SI</th> <th>combine_SI</th>
<td><p>a logical to indicate whether all values of S and I must be merged into one, so the output only consists of S+I vs. R (susceptible vs. resistant). This used to be the parameter <code>combine_IR</code>, but this now follows the redefinition by EUCAST about the interpretion of I (increased exposure) in 2019, see section 'Interpretation of S, I and R' below. Default is <code>TRUE</code>.</p></td> <td><p>a logical to indicate whether all values of S and I must be merged into one, so the output only consists of S+I vs. R (susceptible vs. resistant). This used to be the parameter <code>combine_IR</code>, but this now follows the redefinition by EUCAST about the interpretation of I (increased exposure) in 2019, see section 'Interpretation of S, I and R' below. Default is <code>TRUE</code>.</p></td>
</tr> </tr>
<tr> <tr>
<th>combine_IR</th> <th>combine_IR</th>

View File

@ -81,7 +81,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9040</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9041</span>
</span> </span>
</div> </div>

View File

@ -82,7 +82,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9032</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9041</span>
</span> </span>
</div> </div>
@ -90,14 +90,14 @@
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li> <li>
<a href="../index.html"> <a href="../index.html">
<span class="fa fa-home"></span> <span class="fas fa-home"></span>
Home Home
</a> </a>
</li> </li>
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<span class="fa fa-question-circle"></span> <span class="fas fa-question-circle"></span>
How to How to
@ -106,77 +106,77 @@
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
<li> <li>
<a href="../articles/AMR.html"> <a href="../articles/AMR.html">
<span class="fa fa-directions"></span> <span class="fas fa-directions"></span>
Conduct AMR analysis Conduct AMR analysis
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/resistance_predict.html"> <a href="../articles/resistance_predict.html">
<span class="fa fa-dice"></span> <span class="fas fa-dice"></span>
Predict antimicrobial resistance Predict antimicrobial resistance
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/datasets.html"> <a href="../articles/datasets.html">
<span class="fa fa-database"></span> <span class="fas fa-database"></span>
Data sets for download / own use Data sets for download / own use
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/PCA.html"> <a href="../articles/PCA.html">
<span class="fa fa-compress"></span> <span class="fas fa-compress"></span>
Conduct principal component analysis for AMR Conduct principal component analysis for AMR
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/MDR.html"> <a href="../articles/MDR.html">
<span class="fa fa-skull-crossbones"></span> <span class="fas fa-skull-crossbones"></span>
Determine multi-drug resistance (MDR) Determine multi-drug resistance (MDR)
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/WHONET.html"> <a href="../articles/WHONET.html">
<span class="fa fa-globe-americas"></span> <span class="fas fa-globe-americas"></span>
Work with WHONET data Work with WHONET data
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/SPSS.html"> <a href="../articles/SPSS.html">
<span class="fa fa-file-upload"></span> <span class="fas fa-file-upload"></span>
Import data from SPSS/SAS/Stata Import data from SPSS/SAS/Stata
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/EUCAST.html"> <a href="../articles/EUCAST.html">
<span class="fa fa-exchange-alt"></span> <span class="fas fa-exchange-alt"></span>
Apply EUCAST rules Apply EUCAST rules
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/mo_property.html"> <a href="../reference/mo_property.html">
<span class="fa fa-bug"></span> <span class="fas fa-bug"></span>
Get properties of a microorganism Get properties of a microorganism
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/ab_property.html"> <a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span> <span class="fas fa-capsules"></span>
Get properties of an antibiotic Get properties of an antibiotic
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/benchmarks.html"> <a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span> <span class="fas fa-shipping-fast"></span>
Other: benchmarks Other: benchmarks
</a> </a>
@ -185,21 +185,21 @@
</li> </li>
<li> <li>
<a href="../reference/index.html"> <a href="../reference/index.html">
<span class="fa fa-book-open"></span> <span class="fas fa-book-open"></span>
Manual Manual
</a> </a>
</li> </li>
<li> <li>
<a href="../authors.html"> <a href="../authors.html">
<span class="fa fa-users"></span> <span class="fas fa-users"></span>
Authors Authors
</a> </a>
</li> </li>
<li> <li>
<a href="../news/index.html"> <a href="../news/index.html">
<span class="far fa far fa-newspaper"></span> <span class="far fa-newspaper"></span>
Changelog Changelog
</a> </a>
@ -208,14 +208,14 @@
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li> <li>
<a href="https://github.com/msberends/AMR"> <a href="https://github.com/msberends/AMR">
<span class="fab fa fab fa-github"></span> <span class="fab fa-github"></span>
Source Code Source Code
</a> </a>
</li> </li>
<li> <li>
<a href="../survey.html"> <a href="../survey.html">
<span class="fa fa-clipboard-list"></span> <span class="fas fa-clipboard-list"></span>
Survey Survey
</a> </a>
@ -263,7 +263,7 @@
</tr> </tr>
<tr> <tr>
<th>by</th> <th>by</th>
<td><p>a variable to join by - if left empty will search for a column with class <code><a href='as.mo.html'>mo</a></code> (created with <code><a href='as.mo.html'>as.mo()</a></code>) or will be <code>"mo"</code> if that column name exists in <code>x</code>, could otherwise be a column name of <code>x</code> with values that exist in <code>microorganisms$mo</code> (like <code>by = "bacteria_id"</code>), or another column in <a href='microorganisms.html'>microorganisms</a> (but then it should be named, like <code>by = c("bacteria_id" = "fullname")</code>)</p></td> <td><p>a variable to join by - if left empty will search for a column with class <code><a href='as.mo.html'>mo</a></code> (created with <code><a href='as.mo.html'>as.mo()</a></code>) or will be <code>"mo"</code> if that column name exists in <code>x</code>, could otherwise be a column name of <code>x</code> with values that exist in <code>microorganisms$mo</code> (such as <code>by = "bacteria_id"</code>), or another column in <a href='microorganisms.html'>microorganisms</a> (but then it should be named, like <code>by = c("bacteria_id" = "fullname")</code>)</p></td>
</tr> </tr>
<tr> <tr>
<th>suffix</th> <th>suffix</th>

View File

@ -82,7 +82,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9034</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9041</span>
</span> </span>
</div> </div>
@ -90,14 +90,14 @@
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li> <li>
<a href="../index.html"> <a href="../index.html">
<span class="fa fa-home"></span> <span class="fas fa-home"></span>
Home Home
</a> </a>
</li> </li>
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<span class="fa fa-question-circle"></span> <span class="fas fa-question-circle"></span>
How to How to
@ -106,77 +106,77 @@
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
<li> <li>
<a href="../articles/AMR.html"> <a href="../articles/AMR.html">
<span class="fa fa-directions"></span> <span class="fas fa-directions"></span>
Conduct AMR analysis Conduct AMR analysis
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/resistance_predict.html"> <a href="../articles/resistance_predict.html">
<span class="fa fa-dice"></span> <span class="fas fa-dice"></span>
Predict antimicrobial resistance Predict antimicrobial resistance
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/datasets.html"> <a href="../articles/datasets.html">
<span class="fa fa-database"></span> <span class="fas fa-database"></span>
Data sets for download / own use Data sets for download / own use
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/PCA.html"> <a href="../articles/PCA.html">
<span class="fa fa-compress"></span> <span class="fas fa-compress"></span>
Conduct principal component analysis for AMR Conduct principal component analysis for AMR
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/MDR.html"> <a href="../articles/MDR.html">
<span class="fa fa-skull-crossbones"></span> <span class="fas fa-skull-crossbones"></span>
Determine multi-drug resistance (MDR) Determine multi-drug resistance (MDR)
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/WHONET.html"> <a href="../articles/WHONET.html">
<span class="fa fa-globe-americas"></span> <span class="fas fa-globe-americas"></span>
Work with WHONET data Work with WHONET data
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/SPSS.html"> <a href="../articles/SPSS.html">
<span class="fa fa-file-upload"></span> <span class="fas fa-file-upload"></span>
Import data from SPSS/SAS/Stata Import data from SPSS/SAS/Stata
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/EUCAST.html"> <a href="../articles/EUCAST.html">
<span class="fa fa-exchange-alt"></span> <span class="fas fa-exchange-alt"></span>
Apply EUCAST rules Apply EUCAST rules
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/mo_property.html"> <a href="../reference/mo_property.html">
<span class="fa fa-bug"></span> <span class="fas fa-bug"></span>
Get properties of a microorganism Get properties of a microorganism
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/ab_property.html"> <a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span> <span class="fas fa-capsules"></span>
Get properties of an antibiotic Get properties of an antibiotic
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/benchmarks.html"> <a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span> <span class="fas fa-shipping-fast"></span>
Other: benchmarks Other: benchmarks
</a> </a>
@ -185,21 +185,21 @@
</li> </li>
<li> <li>
<a href="../reference/index.html"> <a href="../reference/index.html">
<span class="fa fa-book-open"></span> <span class="fas fa-book-open"></span>
Manual Manual
</a> </a>
</li> </li>
<li> <li>
<a href="../authors.html"> <a href="../authors.html">
<span class="fa fa-users"></span> <span class="fas fa-users"></span>
Authors Authors
</a> </a>
</li> </li>
<li> <li>
<a href="../news/index.html"> <a href="../news/index.html">
<span class="far fa far fa-newspaper"></span> <span class="far fa-newspaper"></span>
Changelog Changelog
</a> </a>
@ -208,14 +208,14 @@
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li> <li>
<a href="https://github.com/msberends/AMR"> <a href="https://github.com/msberends/AMR">
<span class="fab fa fab fa-github"></span> <span class="fab fa-github"></span>
Source Code Source Code
</a> </a>
</li> </li>
<li> <li>
<a href="../survey.html"> <a href="../survey.html">
<span class="fa fa-clipboard-list"></span> <span class="fas fa-clipboard-list"></span>
Survey Survey
</a> </a>
@ -344,7 +344,7 @@
<li><p><code>mo_ref("Shimwellia blattae")</code> will return <code>"Priest et al., 2010"</code> (without a message)</p></li> <li><p><code>mo_ref("Shimwellia blattae")</code> will return <code>"Priest et al., 2010"</code> (without a message)</p></li>
</ul> </ul>
<p>The short name - <code>mo_shortname()</code> - almost always returns the first character of the genus and the full species, like <code>"E. coli"</code>. Exceptions are abbreviations of staphylococci (like <em>"CoNS"</em>, Coagulase-Negative Staphylococci) and beta-haemolytic streptococci (like <em>"GBS"</em>, Group B Streptococci). Please bear in mind that e.g. <em>E. coli</em> could mean <em>Escherichia coli</em> (kingdom of Bacteria) as well as <em>Entamoeba coli</em> (kingdom of Protozoa). Returning to the full name will be done using <code><a href='as.mo.html'>as.mo()</a></code> internally, giving priority to bacteria and human pathogens, i.e. <code>"E. coli"</code> will be considered <em>Escherichia coli</em>. In other words, <code>mo_fullname(mo_shortname("Entamoeba coli"))</code> returns <code>"Escherichia coli"</code>.</p> <p>The short name - <code>mo_shortname()</code> - almost always returns the first character of the genus and the full species, like <code>"E. coli"</code>. Exceptions are abbreviations of staphylococci (such as <em>"CoNS"</em>, Coagulase-Negative Staphylococci) and beta-haemolytic streptococci (such as <em>"GBS"</em>, Group B Streptococci). Please bear in mind that e.g. <em>E. coli</em> could mean <em>Escherichia coli</em> (kingdom of Bacteria) as well as <em>Entamoeba coli</em> (kingdom of Protozoa). Returning to the full name will be done using <code><a href='as.mo.html'>as.mo()</a></code> internally, giving priority to bacteria and human pathogens, i.e. <code>"E. coli"</code> will be considered <em>Escherichia coli</em>. In other words, <code>mo_fullname(mo_shortname("Entamoeba coli"))</code> returns <code>"Escherichia coli"</code>.</p>
<p>Since the top-level of the taxonomy is sometimes referred to as 'kingdom' and sometimes as 'domain', the functions <code>mo_kingdom()</code> and <code>mo_domain()</code> return the exact same results.</p> <p>Since the top-level of the taxonomy is sometimes referred to as 'kingdom' and sometimes as 'domain', the functions <code>mo_kingdom()</code> and <code>mo_domain()</code> return the exact same results.</p>
<p>The Gram stain - <code>mo_gramstain()</code> - will be determined based on the taxonomic kingdom and phylum. According to Cavalier-Smith (2002, <a href='https://pubmed.ncbi.nlm.nih.gov/11837318'>PMID 11837318</a>), who defined subkingdoms Negibacteria and Posibacteria, only these phyla are Posibacteria: Actinobacteria, Chloroflexi, Firmicutes and Tenericutes. These bacteria are considered Gram-positive - all other bacteria are considered Gram-negative. Species outside the kingdom of Bacteria will return a value <code>NA</code>. Functions <code>mo_is_gram_negative()</code> and <code>mo_is_gram_positive()</code> always return <code>TRUE</code> or <code>FALSE</code> (except when the input is <code>NA</code> or the MO code is <code>UNKNOWN</code>), thus always return <code>FALSE</code> for species outside the taxonomic kingdom of Bacteria.</p> <p>The Gram stain - <code>mo_gramstain()</code> - will be determined based on the taxonomic kingdom and phylum. According to Cavalier-Smith (2002, <a href='https://pubmed.ncbi.nlm.nih.gov/11837318'>PMID 11837318</a>), who defined subkingdoms Negibacteria and Posibacteria, only these phyla are Posibacteria: Actinobacteria, Chloroflexi, Firmicutes and Tenericutes. These bacteria are considered Gram-positive - all other bacteria are considered Gram-negative. Species outside the kingdom of Bacteria will return a value <code>NA</code>. Functions <code>mo_is_gram_negative()</code> and <code>mo_is_gram_positive()</code> always return <code>TRUE</code> or <code>FALSE</code> (except when the input is <code>NA</code> or the MO code is <code>UNKNOWN</code>), thus always return <code>FALSE</code> for species outside the taxonomic kingdom of Bacteria.</p>
<p>Intrinsic resistance - <code>mo_is_intrinsic_resistant()</code> - will be determined based on the <a href='intrinsic_resistant.html'>intrinsic_resistant</a> data set, which is based on <a href='https://www.eucast.org/expert_rules_and_intrinsic_resistance/'>'EUCAST Expert Rules' and 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.2</a> from 2020. The <code>mo_is_intrinsic_resistant()</code> can be vectorised over parameters <code>x</code> (input for microorganisms) and over <code>ab</code> (input for antibiotics).</p> <p>Intrinsic resistance - <code>mo_is_intrinsic_resistant()</code> - will be determined based on the <a href='intrinsic_resistant.html'>intrinsic_resistant</a> data set, which is based on <a href='https://www.eucast.org/expert_rules_and_intrinsic_resistance/'>'EUCAST Expert Rules' and 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.2</a> from 2020. The <code>mo_is_intrinsic_resistant()</code> can be vectorised over parameters <code>x</code> (input for microorganisms) and over <code>ab</code> (input for antibiotics).</p>

View File

@ -83,7 +83,7 @@ This is the fastest way to have your organisation (or analysis) specific codes p
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9032</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9041</span>
</span> </span>
</div> </div>
@ -91,14 +91,14 @@ This is the fastest way to have your organisation (or analysis) specific codes p
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li> <li>
<a href="../index.html"> <a href="../index.html">
<span class="fa fa-home"></span> <span class="fas fa-home"></span>
Home Home
</a> </a>
</li> </li>
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<span class="fa fa-question-circle"></span> <span class="fas fa-question-circle"></span>
How to How to
@ -107,77 +107,77 @@ This is the fastest way to have your organisation (or analysis) specific codes p
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
<li> <li>
<a href="../articles/AMR.html"> <a href="../articles/AMR.html">
<span class="fa fa-directions"></span> <span class="fas fa-directions"></span>
Conduct AMR analysis Conduct AMR analysis
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/resistance_predict.html"> <a href="../articles/resistance_predict.html">
<span class="fa fa-dice"></span> <span class="fas fa-dice"></span>
Predict antimicrobial resistance Predict antimicrobial resistance
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/datasets.html"> <a href="../articles/datasets.html">
<span class="fa fa-database"></span> <span class="fas fa-database"></span>
Data sets for download / own use Data sets for download / own use
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/PCA.html"> <a href="../articles/PCA.html">
<span class="fa fa-compress"></span> <span class="fas fa-compress"></span>
Conduct principal component analysis for AMR Conduct principal component analysis for AMR
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/MDR.html"> <a href="../articles/MDR.html">
<span class="fa fa-skull-crossbones"></span> <span class="fas fa-skull-crossbones"></span>
Determine multi-drug resistance (MDR) Determine multi-drug resistance (MDR)
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/WHONET.html"> <a href="../articles/WHONET.html">
<span class="fa fa-globe-americas"></span> <span class="fas fa-globe-americas"></span>
Work with WHONET data Work with WHONET data
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/SPSS.html"> <a href="../articles/SPSS.html">
<span class="fa fa-file-upload"></span> <span class="fas fa-file-upload"></span>
Import data from SPSS/SAS/Stata Import data from SPSS/SAS/Stata
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/EUCAST.html"> <a href="../articles/EUCAST.html">
<span class="fa fa-exchange-alt"></span> <span class="fas fa-exchange-alt"></span>
Apply EUCAST rules Apply EUCAST rules
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/mo_property.html"> <a href="../reference/mo_property.html">
<span class="fa fa-bug"></span> <span class="fas fa-bug"></span>
Get properties of a microorganism Get properties of a microorganism
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/ab_property.html"> <a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span> <span class="fas fa-capsules"></span>
Get properties of an antibiotic Get properties of an antibiotic
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/benchmarks.html"> <a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span> <span class="fas fa-shipping-fast"></span>
Other: benchmarks Other: benchmarks
</a> </a>
@ -186,21 +186,21 @@ This is the fastest way to have your organisation (or analysis) specific codes p
</li> </li>
<li> <li>
<a href="../reference/index.html"> <a href="../reference/index.html">
<span class="fa fa-book-open"></span> <span class="fas fa-book-open"></span>
Manual Manual
</a> </a>
</li> </li>
<li> <li>
<a href="../authors.html"> <a href="../authors.html">
<span class="fa fa-users"></span> <span class="fas fa-users"></span>
Authors Authors
</a> </a>
</li> </li>
<li> <li>
<a href="../news/index.html"> <a href="../news/index.html">
<span class="far fa far fa-newspaper"></span> <span class="far fa-newspaper"></span>
Changelog Changelog
</a> </a>
@ -209,14 +209,14 @@ This is the fastest way to have your organisation (or analysis) specific codes p
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li> <li>
<a href="https://github.com/msberends/AMR"> <a href="https://github.com/msberends/AMR">
<span class="fab fa fab fa-github"></span> <span class="fab fa-github"></span>
Source Code Source Code
</a> </a>
</li> </li>
<li> <li>
<a href="../survey.html"> <a href="../survey.html">
<span class="fa fa-clipboard-list"></span> <span class="fas fa-clipboard-list"></span>
Survey Survey
</a> </a>
@ -244,9 +244,12 @@ This is the fastest way to have your organisation (or analysis) specific codes p
<p>This is <strong>the fastest way</strong> to have your organisation (or analysis) specific codes picked up and translated by this package.</p> <p>This is <strong>the fastest way</strong> to have your organisation (or analysis) specific codes picked up and translated by this package.</p>
</div> </div>
<pre class="usage"><span class='fu'>set_mo_source</span><span class='op'>(</span><span class='va'>path</span><span class='op'>)</span> <pre class="usage"><span class='fu'>set_mo_source</span><span class='op'>(</span>
<span class='va'>path</span>,
destination <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/options.html'>getOption</a></span><span class='op'>(</span><span class='st'>"AMR_mo_source"</span>, <span class='st'>"~/mo_source.rds"</span><span class='op'>)</span>
<span class='op'>)</span>
<span class='fu'>get_mo_source</span><span class='op'>(</span><span class='op'>)</span></pre> <span class='fu'>get_mo_source</span><span class='op'>(</span>destination <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/options.html'>getOption</a></span><span class='op'>(</span><span class='st'>"AMR_mo_source"</span>, <span class='st'>"~/mo_source.rds"</span><span class='op'>)</span><span class='op'>)</span></pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2> <h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments"> <table class="ref-arguments">
@ -255,14 +258,18 @@ This is the fastest way to have your organisation (or analysis) specific codes p
<th>path</th> <th>path</th>
<td><p>location of your reference file, see Details. Can be <code>""</code>, <code>NULL</code> or <code>FALSE</code> to delete the reference file.</p></td> <td><p>location of your reference file, see Details. Can be <code>""</code>, <code>NULL</code> or <code>FALSE</code> to delete the reference file.</p></td>
</tr> </tr>
<tr>
<th>destination</th>
<td><p>destination of the compressed data file, default to the user's home directory.</p></td>
</tr>
</table> </table>
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2> <h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
<p>The reference file can be a text file separated with commas (CSV) or tabs or pipes, an Excel file (either 'xls' or 'xlsx' format) or an R object file (extension '.rds'). To use an Excel file, you will need to have the <code>readxl</code> package installed.</p> <p>The reference file can be a text file separated with commas (CSV) or tabs or pipes, an Excel file (either 'xls' or 'xlsx' format) or an R object file (extension '.rds'). To use an Excel file, you will need to have the <code>readxl</code> package installed.</p>
<p><code>set_mo_source()</code> will check the file for validity: it must be a <a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a>, must have a column named <code>"mo"</code> which contains values from <code><a href='microorganisms.html'>microorganisms$mo</a></code> and must have a reference column with your own defined values. If all tests pass, <code>set_mo_source()</code> will read the file into R and will ask to export it to <code>"~/.mo_source.rds"</code>. The CRAN policy disallows packages to write to the file system, although '<em>exceptions may be allowed in interactive sessions if the package obtains confirmation from the user</em>'. For this reason, this function only works in interactive sessions so that the user can <strong>specifically confirm and allow</strong> that this file will be created.</p> <p><code>set_mo_source()</code> will check the file for validity: it must be a <a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a>, must have a column named <code>"mo"</code> which contains values from <code><a href='microorganisms.html'>microorganisms$mo</a></code> and must have a reference column with your own defined values. If all tests pass, <code>set_mo_source()</code> will read the file into R and will ask to export it to <code>"~/mo_source.rds"</code>. The CRAN policy disallows packages to write to the file system, although '<em>exceptions may be allowed in interactive sessions if the package obtains confirmation from the user</em>'. For this reason, this function only works in interactive sessions so that the user can <strong>specifically confirm and allow</strong> that this file will be created. The destination of this file can be set with the <code>destination</code> parameter and defaults to the user's home directory. It can also be set as an <span style="R">R</span> option, using <code>options(AMR_mo_source = "my/location/file.rds)</code>.</p>
<p>The created compressed data file <code>"~/.mo_source.rds"</code> will be used at default for MO determination (function <code><a href='as.mo.html'>as.mo()</a></code> and consequently all <code>mo_*</code> functions like <code><a href='mo_property.html'>mo_genus()</a></code> and <code><a href='mo_property.html'>mo_gramstain()</a></code>). The location of the original file will be saved as an R option with <code><a href='https://rdrr.io/r/base/options.html'>options(mo_source = path)</a></code>. Its timestamp will be saved with <code><a href='https://rdrr.io/r/base/options.html'>options(mo_source_datetime = ...)</a></code>.</p> <p>The created compressed data file <code>"mo_source.rds"</code> will be used at default for MO determination (function <code><a href='as.mo.html'>as.mo()</a></code> and consequently all <code>mo_*</code> functions like <code><a href='mo_property.html'>mo_genus()</a></code> and <code><a href='mo_property.html'>mo_gramstain()</a></code>). The location and timestamp of the original file will be saved as an attribute to the compressed data file.</p>
<p>The function <code>get_mo_source()</code> will return the data set by reading <code>"~/.mo_source.rds"</code> with <code><a href='https://rdrr.io/r/base/readRDS.html'>readRDS()</a></code>. If the original file has changed (by checking the aforementioned options <code>mo_source</code> and <code>mo_source_datetime</code>), it will call <code>set_mo_source()</code> to update the data file automatically if used in an interactive session.</p> <p>The function <code>get_mo_source()</code> will return the data set by reading <code>"mo_source.rds"</code> with <code><a href='https://rdrr.io/r/base/readRDS.html'>readRDS()</a></code>. If the original file has changed (by checking the location and timestamp of the original file), it will call <code>set_mo_source()</code> to update the data file automatically if used in an interactive session.</p>
<p>Reading an Excel file (<code>.xlsx</code>) with only one row has a size of 8-9 kB. The compressed file created with <code>set_mo_source()</code> will then have a size of 0.1 kB and can be read by <code>get_mo_source()</code> in only a couple of microseconds (millionths of a second).</p> <p>Reading an Excel file (<code>.xlsx</code>) with only one row has a size of 8-9 kB. The compressed file created with <code>set_mo_source()</code> will then have a size of 0.1 kB and can be read by <code>get_mo_source()</code> in only a couple of microseconds (millionths of a second).</p>
<h2 class="hasAnchor" id="how-to-setup"><a class="anchor" href="#how-to-setup"></a>How to setup</h2> <h2 class="hasAnchor" id="how-to-setup"><a class="anchor" href="#how-to-setup"></a>How to setup</h2>
@ -278,12 +285,14 @@ This is the fastest way to have your organisation (or analysis) specific codes p
</pre> </pre>
<p>We save it as <code>"home/me/ourcodes.xlsx"</code>. Now we have to set it as a source:</p><pre><span class='fu'>set_mo_source</span><span class='op'>(</span><span class='st'>"home/me/ourcodes.xlsx"</span><span class='op'>)</span> <p>We save it as <code>"home/me/ourcodes.xlsx"</code>. Now we have to set it as a source:</p><pre><span class='fu'>set_mo_source</span><span class='op'>(</span><span class='st'>"home/me/ourcodes.xlsx"</span><span class='op'>)</span>
<span class='co'>#&gt; NOTE: Created mo_source file '~/.mo_source.rds' from 'home/me/ourcodes.xlsx'</span> <span class='co'>#&gt; NOTE: Created mo_source file '/Users/me/mo_source.rds' (0.3 kB) from</span>
<span class='co'>#&gt; (columns "Organisation XYZ" and "mo")</span> <span class='co'>#&gt; '/Users/me/Documents/ourcodes.xlsx' (9 kB), columns </span>
<span class='co'>#&gt; "Organisation XYZ" and "mo"</span>
</pre> </pre>
<p>It has now created a file <code>"~/.mo_source.rds"</code> with the contents of our Excel file. Only the first column with foreign values and the 'mo' column will be kept when creating the RDS file.</p> <p>It has now created a file <code>"~/mo_source.rds"</code> with the contents of our Excel file. Only the first column with foreign values and the 'mo' column will be kept when creating the RDS file.</p>
<p>And now we can use it in our functions:</p><pre><span class='fu'><a href='as.mo.html'>as.mo</a></span><span class='op'>(</span><span class='st'>"lab_mo_ecoli"</span><span class='op'>)</span> <p>And now we can use it in our functions:</p><pre><span class='fu'><a href='as.mo.html'>as.mo</a></span><span class='op'>(</span><span class='st'>"lab_mo_ecoli"</span><span class='op'>)</span>
<span class='co'>#&gt; Class &lt;mo&gt;</span>
<span class='co'>#&gt; [1] B_ESCHR_COLI</span> <span class='co'>#&gt; [1] B_ESCHR_COLI</span>
<span class='fu'><a href='mo_property.html'>mo_genus</a></span><span class='op'>(</span><span class='st'>"lab_mo_kpneumoniae"</span><span class='op'>)</span> <span class='fu'><a href='mo_property.html'>mo_genus</a></span><span class='op'>(</span><span class='st'>"lab_mo_kpneumoniae"</span><span class='op'>)</span>
@ -291,6 +300,9 @@ This is the fastest way to have your organisation (or analysis) specific codes p
<span class='co'># other input values still work too</span> <span class='co'># other input values still work too</span>
<span class='fu'><a href='as.mo.html'>as.mo</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span><span class='st'>"Escherichia coli"</span>, <span class='st'>"E. coli"</span>, <span class='st'>"lab_mo_ecoli"</span><span class='op'>)</span><span class='op'>)</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span><span class='st'>"Escherichia coli"</span>, <span class='st'>"E. coli"</span>, <span class='st'>"lab_mo_ecoli"</span><span class='op'>)</span><span class='op'>)</span>
<span class='co'>#&gt; NOTE: Translation to one microorganism was guessed with uncertainty.</span>
<span class='co'>#&gt; Use mo_uncertainties() to review it.</span>
<span class='co'>#&gt; Class &lt;mo&gt;</span>
<span class='co'>#&gt; [1] B_ESCHR_COLI B_ESCHR_COLI B_ESCHR_COLI</span> <span class='co'>#&gt; [1] B_ESCHR_COLI B_ESCHR_COLI B_ESCHR_COLI</span>
</pre> </pre>
@ -304,8 +316,10 @@ This is the fastest way to have your organisation (or analysis) specific codes p
</pre> </pre>
<p>...any new usage of an MO function in this package will update your data file:</p><pre><span class='fu'><a href='as.mo.html'>as.mo</a></span><span class='op'>(</span><span class='st'>"lab_mo_ecoli"</span><span class='op'>)</span> <p>...any new usage of an MO function in this package will update your data file:</p><pre><span class='fu'><a href='as.mo.html'>as.mo</a></span><span class='op'>(</span><span class='st'>"lab_mo_ecoli"</span><span class='op'>)</span>
<span class='co'>#&gt; NOTE: Updated mo_source file '~/.mo_source.rds' from 'home/me/ourcodes.xlsx'</span> <span class='co'>#&gt; NOTE: Updated mo_source file '/Users/me/mo_source.rds' (0.3 kB) from </span>
<span class='co'>#&gt; (columns "Organisation XYZ" and "mo")</span> <span class='co'>#&gt; '/Users/me/Documents/ourcodes.xlsx' (9 kB), columns</span>
<span class='co'>#&gt; "Organisation XYZ" and "mo"</span>
<span class='co'>#&gt; Class &lt;mo&gt;</span>
<span class='co'>#&gt; [1] B_ESCHR_COLI</span> <span class='co'>#&gt; [1] B_ESCHR_COLI</span>
<span class='fu'><a href='mo_property.html'>mo_genus</a></span><span class='op'>(</span><span class='st'>"lab_Staph_aureus"</span><span class='op'>)</span> <span class='fu'><a href='mo_property.html'>mo_genus</a></span><span class='op'>(</span><span class='st'>"lab_Staph_aureus"</span><span class='op'>)</span>
@ -313,10 +327,10 @@ This is the fastest way to have your organisation (or analysis) specific codes p
</pre> </pre>
<p>To delete the reference data file, just use <code>""</code>, <code>NULL</code> or <code>FALSE</code> as input for <code>set_mo_source()</code>:</p><pre><span class='fu'>set_mo_source</span><span class='op'>(</span><span class='cn'>NULL</span><span class='op'>)</span> <p>To delete the reference data file, just use <code>""</code>, <code>NULL</code> or <code>FALSE</code> as input for <code>set_mo_source()</code>:</p><pre><span class='fu'>set_mo_source</span><span class='op'>(</span><span class='cn'>NULL</span><span class='op'>)</span>
<span class='co'># Removed mo_source file '~/.mo_source.rds'.</span> <span class='co'>#&gt; Removed mo_source file '/Users/me/mo_source.rds'</span>
</pre> </pre>
<p>If the original Excel file is moved or deleted, the mo_source file will be removed upon the next use of <code><a href='as.mo.html'>as.mo()</a></code>. If the mo_source file is manually deleted (i.e. without using <code>set_mo_source()</code>), the references to the mo_source file will be removed upon the next use of <code><a href='as.mo.html'>as.mo()</a></code>.</p> <p>If the original Excel file is moved or deleted, the mo_source file will be removed upon the next use of <code><a href='as.mo.html'>as.mo()</a></code>.</p>
<h2 class="hasAnchor" id="stable-lifecycle"><a class="anchor" href="#stable-lifecycle"></a>Stable lifecycle</h2> <h2 class="hasAnchor" id="stable-lifecycle"><a class="anchor" href="#stable-lifecycle"></a>Stable lifecycle</h2>

View File

@ -82,7 +82,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9040</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9041</span>
</span> </span>
</div> </div>

View File

@ -83,7 +83,7 @@ resistance() should be used to calculate resistance, susceptibility() should be
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9032</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9041</span>
</span> </span>
</div> </div>
@ -91,14 +91,14 @@ resistance() should be used to calculate resistance, susceptibility() should be
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li> <li>
<a href="../index.html"> <a href="../index.html">
<span class="fa fa-home"></span> <span class="fas fa-home"></span>
Home Home
</a> </a>
</li> </li>
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<span class="fa fa-question-circle"></span> <span class="fas fa-question-circle"></span>
How to How to
@ -107,77 +107,77 @@ resistance() should be used to calculate resistance, susceptibility() should be
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
<li> <li>
<a href="../articles/AMR.html"> <a href="../articles/AMR.html">
<span class="fa fa-directions"></span> <span class="fas fa-directions"></span>
Conduct AMR analysis Conduct AMR analysis
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/resistance_predict.html"> <a href="../articles/resistance_predict.html">
<span class="fa fa-dice"></span> <span class="fas fa-dice"></span>
Predict antimicrobial resistance Predict antimicrobial resistance
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/datasets.html"> <a href="../articles/datasets.html">
<span class="fa fa-database"></span> <span class="fas fa-database"></span>
Data sets for download / own use Data sets for download / own use
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/PCA.html"> <a href="../articles/PCA.html">
<span class="fa fa-compress"></span> <span class="fas fa-compress"></span>
Conduct principal component analysis for AMR Conduct principal component analysis for AMR
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/MDR.html"> <a href="../articles/MDR.html">
<span class="fa fa-skull-crossbones"></span> <span class="fas fa-skull-crossbones"></span>
Determine multi-drug resistance (MDR) Determine multi-drug resistance (MDR)
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/WHONET.html"> <a href="../articles/WHONET.html">
<span class="fa fa-globe-americas"></span> <span class="fas fa-globe-americas"></span>
Work with WHONET data Work with WHONET data
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/SPSS.html"> <a href="../articles/SPSS.html">
<span class="fa fa-file-upload"></span> <span class="fas fa-file-upload"></span>
Import data from SPSS/SAS/Stata Import data from SPSS/SAS/Stata
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/EUCAST.html"> <a href="../articles/EUCAST.html">
<span class="fa fa-exchange-alt"></span> <span class="fas fa-exchange-alt"></span>
Apply EUCAST rules Apply EUCAST rules
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/mo_property.html"> <a href="../reference/mo_property.html">
<span class="fa fa-bug"></span> <span class="fas fa-bug"></span>
Get properties of a microorganism Get properties of a microorganism
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/ab_property.html"> <a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span> <span class="fas fa-capsules"></span>
Get properties of an antibiotic Get properties of an antibiotic
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/benchmarks.html"> <a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span> <span class="fas fa-shipping-fast"></span>
Other: benchmarks Other: benchmarks
</a> </a>
@ -186,21 +186,21 @@ resistance() should be used to calculate resistance, susceptibility() should be
</li> </li>
<li> <li>
<a href="../reference/index.html"> <a href="../reference/index.html">
<span class="fa fa-book-open"></span> <span class="fas fa-book-open"></span>
Manual Manual
</a> </a>
</li> </li>
<li> <li>
<a href="../authors.html"> <a href="../authors.html">
<span class="fa fa-users"></span> <span class="fas fa-users"></span>
Authors Authors
</a> </a>
</li> </li>
<li> <li>
<a href="../news/index.html"> <a href="../news/index.html">
<span class="far fa far fa-newspaper"></span> <span class="far fa-newspaper"></span>
Changelog Changelog
</a> </a>
@ -209,14 +209,14 @@ resistance() should be used to calculate resistance, susceptibility() should be
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li> <li>
<a href="https://github.com/msberends/AMR"> <a href="https://github.com/msberends/AMR">
<span class="fab fa fab fa-github"></span> <span class="fab fa-github"></span>
Source Code Source Code
</a> </a>
</li> </li>
<li> <li>
<a href="../survey.html"> <a href="../survey.html">
<span class="fa fa-clipboard-list"></span> <span class="fas fa-clipboard-list"></span>
Survey Survey
</a> </a>
@ -303,7 +303,7 @@ resistance() should be used to calculate resistance, susceptibility() should be
</tr> </tr>
<tr> <tr>
<th>translate_ab</th> <th>translate_ab</th>
<td><p>a column name of the <a href='antibiotics.html'>antibiotics</a> data set to translate the antibiotic abbreviations to, using <code><a href='ab_property.html'>ab_property()</a></code>. Use a value</p></td> <td><p>a column name of the <a href='antibiotics.html'>antibiotics</a> data set to translate the antibiotic abbreviations to, using <code><a href='ab_property.html'>ab_property()</a></code></p></td>
</tr> </tr>
<tr> <tr>
<th>language</th> <th>language</th>
@ -311,7 +311,7 @@ resistance() should be used to calculate resistance, susceptibility() should be
</tr> </tr>
<tr> <tr>
<th>combine_SI</th> <th>combine_SI</th>
<td><p>a logical to indicate whether all values of S and I must be merged into one, so the output only consists of S+I vs. R (susceptible vs. resistant). This used to be the parameter <code>combine_IR</code>, but this now follows the redefinition by EUCAST about the interpretion of I (increased exposure) in 2019, see section 'Interpretation of S, I and R' below. Default is <code>TRUE</code>.</p></td> <td><p>a logical to indicate whether all values of S and I must be merged into one, so the output only consists of S+I vs. R (susceptible vs. resistant). This used to be the parameter <code>combine_IR</code>, but this now follows the redefinition by EUCAST about the interpretation of I (increased exposure) in 2019, see section 'Interpretation of S, I and R' below. Default is <code>TRUE</code>.</p></td>
</tr> </tr>
<tr> <tr>
<th>combine_IR</th> <th>combine_IR</th>

View File

@ -82,7 +82,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9034</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9041</span>
</span> </span>
</div> </div>
@ -90,14 +90,14 @@
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li> <li>
<a href="../index.html"> <a href="../index.html">
<span class="fa fa-home"></span> <span class="fas fa-home"></span>
Home Home
</a> </a>
</li> </li>
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<span class="fa fa-question-circle"></span> <span class="fas fa-question-circle"></span>
How to How to
@ -106,77 +106,77 @@
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
<li> <li>
<a href="../articles/AMR.html"> <a href="../articles/AMR.html">
<span class="fa fa-directions"></span> <span class="fas fa-directions"></span>
Conduct AMR analysis Conduct AMR analysis
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/resistance_predict.html"> <a href="../articles/resistance_predict.html">
<span class="fa fa-dice"></span> <span class="fas fa-dice"></span>
Predict antimicrobial resistance Predict antimicrobial resistance
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/datasets.html"> <a href="../articles/datasets.html">
<span class="fa fa-database"></span> <span class="fas fa-database"></span>
Data sets for download / own use Data sets for download / own use
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/PCA.html"> <a href="../articles/PCA.html">
<span class="fa fa-compress"></span> <span class="fas fa-compress"></span>
Conduct principal component analysis for AMR Conduct principal component analysis for AMR
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/MDR.html"> <a href="../articles/MDR.html">
<span class="fa fa-skull-crossbones"></span> <span class="fas fa-skull-crossbones"></span>
Determine multi-drug resistance (MDR) Determine multi-drug resistance (MDR)
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/WHONET.html"> <a href="../articles/WHONET.html">
<span class="fa fa-globe-americas"></span> <span class="fas fa-globe-americas"></span>
Work with WHONET data Work with WHONET data
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/SPSS.html"> <a href="../articles/SPSS.html">
<span class="fa fa-file-upload"></span> <span class="fas fa-file-upload"></span>
Import data from SPSS/SAS/Stata Import data from SPSS/SAS/Stata
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/EUCAST.html"> <a href="../articles/EUCAST.html">
<span class="fa fa-exchange-alt"></span> <span class="fas fa-exchange-alt"></span>
Apply EUCAST rules Apply EUCAST rules
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/mo_property.html"> <a href="../reference/mo_property.html">
<span class="fa fa-bug"></span> <span class="fas fa-bug"></span>
Get properties of a microorganism Get properties of a microorganism
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/ab_property.html"> <a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span> <span class="fas fa-capsules"></span>
Get properties of an antibiotic Get properties of an antibiotic
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/benchmarks.html"> <a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span> <span class="fas fa-shipping-fast"></span>
Other: benchmarks Other: benchmarks
</a> </a>
@ -185,21 +185,21 @@
</li> </li>
<li> <li>
<a href="../reference/index.html"> <a href="../reference/index.html">
<span class="fa fa-book-open"></span> <span class="fas fa-book-open"></span>
Manual Manual
</a> </a>
</li> </li>
<li> <li>
<a href="../authors.html"> <a href="../authors.html">
<span class="fa fa-users"></span> <span class="fas fa-users"></span>
Authors Authors
</a> </a>
</li> </li>
<li> <li>
<a href="../news/index.html"> <a href="../news/index.html">
<span class="far fa far fa-newspaper"></span> <span class="far fa-newspaper"></span>
Changelog Changelog
</a> </a>
@ -208,14 +208,14 @@
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li> <li>
<a href="https://github.com/msberends/AMR"> <a href="https://github.com/msberends/AMR">
<span class="fab fa fab fa-github"></span> <span class="fab fa-github"></span>
Source Code Source Code
</a> </a>
</li> </li>
<li> <li>
<a href="../survey.html"> <a href="../survey.html">
<span class="fa fa-clipboard-list"></span> <span class="fas fa-clipboard-list"></span>
Survey Survey
</a> </a>
@ -319,7 +319,7 @@
</tr> </tr>
<tr> <tr>
<th>I_as_S</th> <th>I_as_S</th>
<td><p>a logical to indicate whether values <code>I</code> should be treated as <code>S</code> (will otherwise be treated as <code>R</code>). The default, <code>TRUE</code>, follows the redefinition by EUCAST about the interpretion of I (increased exposure) in 2019, see section <em>Interpretation of S, I and R</em> below.</p></td> <td><p>a logical to indicate whether values <code>"I"</code> should be treated as <code>"S"</code> (will otherwise be treated as <code>"R"</code>). The default, <code>TRUE</code>, follows the redefinition by EUCAST about the interpretation of I (increased exposure) in 2019, see section <em>Interpretation of S, I and R</em> below.</p></td>
</tr> </tr>
<tr> <tr>
<th>preserve_measurements</th> <th>preserve_measurements</th>

View File

@ -82,7 +82,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9032</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9041</span>
</span> </span>
</div> </div>
@ -90,14 +90,14 @@
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li> <li>
<a href="../index.html"> <a href="../index.html">
<span class="fa fa-home"></span> <span class="fas fa-home"></span>
Home Home
</a> </a>
</li> </li>
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<span class="fa fa-question-circle"></span> <span class="fas fa-question-circle"></span>
How to How to
@ -106,77 +106,77 @@
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
<li> <li>
<a href="../articles/AMR.html"> <a href="../articles/AMR.html">
<span class="fa fa-directions"></span> <span class="fas fa-directions"></span>
Conduct AMR analysis Conduct AMR analysis
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/resistance_predict.html"> <a href="../articles/resistance_predict.html">
<span class="fa fa-dice"></span> <span class="fas fa-dice"></span>
Predict antimicrobial resistance Predict antimicrobial resistance
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/datasets.html"> <a href="../articles/datasets.html">
<span class="fa fa-database"></span> <span class="fas fa-database"></span>
Data sets for download / own use Data sets for download / own use
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/PCA.html"> <a href="../articles/PCA.html">
<span class="fa fa-compress"></span> <span class="fas fa-compress"></span>
Conduct principal component analysis for AMR Conduct principal component analysis for AMR
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/MDR.html"> <a href="../articles/MDR.html">
<span class="fa fa-skull-crossbones"></span> <span class="fas fa-skull-crossbones"></span>
Determine multi-drug resistance (MDR) Determine multi-drug resistance (MDR)
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/WHONET.html"> <a href="../articles/WHONET.html">
<span class="fa fa-globe-americas"></span> <span class="fas fa-globe-americas"></span>
Work with WHONET data Work with WHONET data
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/SPSS.html"> <a href="../articles/SPSS.html">
<span class="fa fa-file-upload"></span> <span class="fas fa-file-upload"></span>
Import data from SPSS/SAS/Stata Import data from SPSS/SAS/Stata
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/EUCAST.html"> <a href="../articles/EUCAST.html">
<span class="fa fa-exchange-alt"></span> <span class="fas fa-exchange-alt"></span>
Apply EUCAST rules Apply EUCAST rules
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/mo_property.html"> <a href="../reference/mo_property.html">
<span class="fa fa-bug"></span> <span class="fas fa-bug"></span>
Get properties of a microorganism Get properties of a microorganism
</a> </a>
</li> </li>
<li> <li>
<a href="../reference/ab_property.html"> <a href="../reference/ab_property.html">
<span class="fa fa-capsules"></span> <span class="fas fa-capsules"></span>
Get properties of an antibiotic Get properties of an antibiotic
</a> </a>
</li> </li>
<li> <li>
<a href="../articles/benchmarks.html"> <a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span> <span class="fas fa-shipping-fast"></span>
Other: benchmarks Other: benchmarks
</a> </a>
@ -185,21 +185,21 @@
</li> </li>
<li> <li>
<a href="../reference/index.html"> <a href="../reference/index.html">
<span class="fa fa-book-open"></span> <span class="fas fa-book-open"></span>
Manual Manual
</a> </a>
</li> </li>
<li> <li>
<a href="../authors.html"> <a href="../authors.html">
<span class="fa fa-users"></span> <span class="fas fa-users"></span>
Authors Authors
</a> </a>
</li> </li>
<li> <li>
<a href="../news/index.html"> <a href="../news/index.html">
<span class="far fa far fa-newspaper"></span> <span class="far fa-newspaper"></span>
Changelog Changelog
</a> </a>
@ -208,14 +208,14 @@
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li> <li>
<a href="https://github.com/msberends/AMR"> <a href="https://github.com/msberends/AMR">
<span class="fab fa fab fa-github"></span> <span class="fab fa-github"></span>
Source Code Source Code
</a> </a>
</li> </li>
<li> <li>
<a href="../survey.html"> <a href="../survey.html">
<span class="fa fa-clipboard-list"></span> <span class="fas fa-clipboard-list"></span>
Survey Survey
</a> </a>
@ -247,7 +247,7 @@
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2> <h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
<p>Strings will be translated to foreign languages if they are defined in a local translation file. Additions to this file can be suggested at our repository. The file can be found here: <a href='https://github.com/msberends/AMR/blob/master/data-raw/translations.tsv'>https://github.com/msberends/AMR/blob/master/data-raw/translations.tsv</a>. This file will be read by all functions where a translated output can be desired, like all <code><a href='mo_property.html'>mo_property()</a></code> functions (<code><a href='mo_property.html'>mo_name()</a></code>, <code><a href='mo_property.html'>mo_gramstain()</a></code>, <code><a href='mo_property.html'>mo_type()</a></code>, etc.) and <code><a href='ab_property.html'>ab_property()</a></code> functions (<code><a href='ab_property.html'>ab_name()</a></code>, <code><a href='ab_property.html'>ab_group()</a></code> etc.).</p> <p>Strings will be translated to foreign languages if they are defined in a local translation file. Additions to this file can be suggested at our repository. The file can be found here: <a href='https://github.com/msberends/AMR/blob/master/data-raw/translations.tsv'>https://github.com/msberends/AMR/blob/master/data-raw/translations.tsv</a>. This file will be read by all functions where a translated output can be desired, like all <code><a href='mo_property.html'>mo_*</a></code> functions (such as <code><a href='mo_property.html'>mo_name()</a></code>, <code><a href='mo_property.html'>mo_gramstain()</a></code>, <code><a href='mo_property.html'>mo_type()</a></code>, etc.) and <code><a href='ab_property.html'>ab_*</a></code> functions (such as <code><a href='ab_property.html'>ab_name()</a></code>, <code><a href='ab_property.html'>ab_group()</a></code>, etc.).</p>
<p>Currently supported languages are: Dutch, English, French, German, Italian, Portuguese, Spanish. Please note that currently not all these languages have translations available for all antimicrobial agents and colloquial microorganism names.</p> <p>Currently supported languages are: Dutch, English, French, German, Italian, Portuguese, Spanish. Please note that currently not all these languages have translations available for all antimicrobial agents and colloquial microorganism names.</p>
<p>Please suggest your own translations <a href='https://github.com/msberends/AMR/issues/new?title=Translations'>by creating a new issue on our repository</a>.</p><h3 class='hasAnchor' id='arguments'><a class='anchor' href='#arguments'></a>Changing the default language</h3> <p>Please suggest your own translations <a href='https://github.com/msberends/AMR/issues/new?title=Translations'>by creating a new issue on our repository</a>.</p><h3 class='hasAnchor' id='arguments'><a class='anchor' href='#arguments'></a>Changing the default language</h3>

View File

@ -81,7 +81,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9040</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9041</span>
</span> </span>
</div> </div>

View File

@ -23,8 +23,8 @@ This package can be used for:
\item Determining multi-drug resistance (MDR) / multi-drug resistant organisms (MDRO) \item Determining multi-drug resistance (MDR) / multi-drug resistant organisms (MDRO)
\item Calculating (empirical) susceptibility of both mono therapy and combination therapies \item Calculating (empirical) susceptibility of both mono therapy and combination therapies
\item Predicting future antimicrobial resistance using regression models \item Predicting future antimicrobial resistance using regression models
\item Getting properties for any microorganism (like Gram stain, species, genus or family) \item Getting properties for any microorganism (such as Gram stain, species, genus or family)
\item Getting properties for any antibiotic (like name, code of EARS-Net/ATC/LOINC/PubChem, defined daily dose or trade name) \item Getting properties for any antibiotic (such as name, code of EARS-Net/ATC/LOINC/PubChem, defined daily dose or trade name)
\item Plotting antimicrobial resistance \item Plotting antimicrobial resistance
\item Applying EUCAST expert rules \item Applying EUCAST expert rules
\item Getting SNOMED codes of a microorganism, or getting properties of a microorganism based on a SNOMED code \item Getting SNOMED codes of a microorganism, or getting properties of a microorganism based on a SNOMED code

View File

@ -48,7 +48,7 @@ With \code{type = "administration"} (or abbreviations, like "admin", "adm"), all
Without using \code{collapse}, this function will return a \link{list}. This can be convenient to use e.g. inside a \code{mutate()}):\cr Without using \code{collapse}, this function will return a \link{list}. This can be convenient to use e.g. inside a \code{mutate()}):\cr
\code{df \%>\% mutate(abx = ab_from_text(clinical_text))} \code{df \%>\% mutate(abx = ab_from_text(clinical_text))}
The returned AB codes can be transformed to official names, groups, etc. with all \code{\link[=ab_property]{ab_property()}} functions like \code{\link[=ab_name]{ab_name()}} and \code{\link[=ab_group]{ab_group()}}, or by using the \code{translate_ab} parameter. The returned AB codes can be transformed to official names, groups, etc. with all \code{\link[=ab_property]{ab_*}} functions such as \code{\link[=ab_name]{ab_name()}} and \code{\link[=ab_group]{ab_group()}}, or by using the \code{translate_ab} parameter.
With using \code{collapse}, this function will return a \link{character}:\cr With using \code{collapse}, this function will return a \link{character}:\cr
\code{df \%>\% mutate(abx = ab_from_text(clinical_text, collapse = "|"))} \code{df \%>\% mutate(abx = ab_from_text(clinical_text, collapse = "|"))}

View File

@ -8,7 +8,7 @@
\format{ \format{
\subsection{For the \link{antibiotics} data set: a \link{data.frame} with 455 observations and 14 variables:}{ \subsection{For the \link{antibiotics} data set: a \link{data.frame} with 455 observations and 14 variables:}{
\itemize{ \itemize{
\item \code{ab}\cr Antibiotic ID as used in this package (like \code{AMC}), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available \item \code{ab}\cr Antibiotic ID as used in this package (such as \code{AMC}), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available
\item \code{atc}\cr ATC code (Anatomical Therapeutic Chemical) as defined by the WHOCC, like \code{J01CR02} \item \code{atc}\cr ATC code (Anatomical Therapeutic Chemical) as defined by the WHOCC, like \code{J01CR02}
\item \code{cid}\cr Compound ID as found in PubChem \item \code{cid}\cr Compound ID as found in PubChem
\item \code{name}\cr Official name as used by WHONET/EARS-Net or the WHO \item \code{name}\cr Official name as used by WHONET/EARS-Net or the WHO
@ -54,7 +54,7 @@ antibiotics
antivirals antivirals
} }
\description{ \description{
Two data sets containing all antibiotics/antimycotics and antivirals. Use \code{\link[=as.ab]{as.ab()}} or one of the \code{\link[=ab_property]{ab_property()}} functions to retrieve values from the \link{antibiotics} data set. Three identifiers are included in this data set: an antibiotic ID (\code{ab}, primarily used in this package) as defined by WHONET/EARS-Net, an ATC code (\code{atc}) as defined by the WHO, and a Compound ID (\code{cid}) as found in PubChem. Other properties in this data set are derived from one or more of these codes. Two data sets containing all antibiotics/antimycotics and antivirals. Use \code{\link[=as.ab]{as.ab()}} or one of the \code{\link[=ab_property]{ab_*}} functions to retrieve values from the \link{antibiotics} data set. Three identifiers are included in this data set: an antibiotic ID (\code{ab}, primarily used in this package) as defined by WHONET/EARS-Net, an ATC code (\code{atc}) as defined by the WHO, and a Compound ID (\code{cid}) as found in PubChem. Other properties in this data set are derived from one or more of these codes.
} }
\details{ \details{
Properties that are based on an ATC code are only available when an ATC is available. These properties are: \code{atc_group1}, \code{atc_group2}, \code{oral_ddd}, \code{oral_units}, \code{iv_ddd} and \code{iv_units}. Properties that are based on an ATC code are only available when an ATC is available. These properties are: \code{atc_group1}, \code{atc_group2}, \code{oral_ddd}, \code{oral_units}, \code{iv_ddd} and \code{iv_units}.

View File

@ -30,13 +30,15 @@ All entries in the \link{antibiotics} data set have three different identifiers:
All these properties will be searched for the user input. The \code{\link[=as.ab]{as.ab()}} can correct for different forms of misspelling: All these properties will be searched for the user input. The \code{\link[=as.ab]{as.ab()}} can correct for different forms of misspelling:
\itemize{ \itemize{
\item Wrong spelling of drug names (like "tobramicin" or "gentamycin"), which corrects for most audible similarities such as f/ph, x/ks, c/z/s, t/th, etc. \item Wrong spelling of drug names (such as "tobramicin" or "gentamycin"), which corrects for most audible similarities such as f/ph, x/ks, c/z/s, t/th, etc.
\item Too few or too many vowels or consonants \item Too few or too many vowels or consonants
\item Switching two characters (like "mreopenem", often the case in clinical data, when doctors typed too fast) \item Switching two characters (such as "mreopenem", often the case in clinical data, when doctors typed too fast)
\item Digitalised paper records, leaving artefacts like 0/o/O (zero and O's), B/8, n/r, etc. \item Digitalised paper records, leaving artefacts like 0/o/O (zero and O's), B/8, n/r, etc.
} }
Use the \code{\link[=ab_property]{ab_property()}} functions to get properties based on the returned antibiotic ID, see Examples. Use the \code{\link[=ab_property]{ab_*}} functions to get properties based on the returned antibiotic ID, see Examples.
Note: the \code{\link[=as.ab]{as.ab()}} and \code{\link[=ab_property]{ab_*}} functions may use very long regular expression to match brand names of antimicrobial agents. This may fail on some systems.
} }
\section{Source}{ \section{Source}{

View File

@ -53,7 +53,7 @@ This excludes \emph{Enterococci} at default (who are in group D), use \code{Lanc
A \link{character} \link{vector} with additional class \code{\link{mo}} A \link{character} \link{vector} with additional class \code{\link{mo}}
} }
\description{ \description{
Use this function to determine a valid microorganism ID (\code{\link{mo}}). Determination is done using intelligent rules and the complete taxonomic kingdoms Bacteria, Chromista, Protozoa, Archaea and most microbial species from the kingdom Fungi (see Source). The input can be almost anything: a full name (like \code{"Staphylococcus aureus"}), an abbreviated name (like \code{"S. aureus"}), an abbreviation known in the field (like \code{"MRSA"}), or just a genus. Please see \emph{Examples}. Use this function to determine a valid microorganism ID (\code{\link{mo}}). Determination is done using intelligent rules and the complete taxonomic kingdoms Bacteria, Chromista, Protozoa, Archaea and most microbial species from the kingdom Fungi (see Source). The input can be almost anything: a full name (like \code{"Staphylococcus aureus"}), an abbreviated name (such as \code{"S. aureus"}), an abbreviation known in the field (such as \code{"MRSA"}), or just a genus. Please see \emph{Examples}.
} }
\details{ \details{
\subsection{General info}{ \subsection{General info}{
@ -220,7 +220,7 @@ mo_is_intrinsic_resistant("E. coli", "vanco") # returns TRUE
\seealso{ \seealso{
\link{microorganisms} for the \link{data.frame} that is being used to determine ID's. \link{microorganisms} for the \link{data.frame} that is being used to determine ID's.
The \code{\link[=mo_property]{mo_property()}} functions (like \code{\link[=mo_genus]{mo_genus()}}, \code{\link[=mo_gramstain]{mo_gramstain()}}) to get properties based on the returned code. The \code{\link[=mo_property]{mo_*}} functions (such as \code{\link[=mo_genus]{mo_genus()}}, \code{\link[=mo_gramstain]{mo_gramstain()}}) to get properties based on the returned code.
} }
\keyword{Becker} \keyword{Becker}
\keyword{Lancefield} \keyword{Lancefield}

View File

@ -39,7 +39,7 @@ bug_drug_combinations(x, col_mo = NULL, FUN = mo_shortname, ...)
\item{minimum}{the minimum allowed number of available (tested) isolates. Any isolate count lower than \code{minimum} will return \code{NA} with a warning. The default number of \code{30} isolates is advised by the Clinical and Laboratory Standards Institute (CLSI) as best practice, see Source.} \item{minimum}{the minimum allowed number of available (tested) isolates. Any isolate count lower than \code{minimum} will return \code{NA} with a warning. The default number of \code{30} isolates is advised by the Clinical and Laboratory Standards Institute (CLSI) as best practice, see Source.}
\item{combine_SI}{a logical to indicate whether all values of S and I must be merged into one, so the output only consists of S+I vs. R (susceptible vs. resistant). This used to be the parameter \code{combine_IR}, but this now follows the redefinition by EUCAST about the interpretion of I (increased exposure) in 2019, see section 'Interpretation of S, I and R' below. Default is \code{TRUE}.} \item{combine_SI}{a logical to indicate whether all values of S and I must be merged into one, so the output only consists of S+I vs. R (susceptible vs. resistant). This used to be the parameter \code{combine_IR}, but this now follows the redefinition by EUCAST about the interpretation of I (increased exposure) in 2019, see section 'Interpretation of S, I and R' below. Default is \code{TRUE}.}
\item{combine_IR}{logical to indicate whether values R and I should be summed} \item{combine_IR}{logical to indicate whether values R and I should be summed}

View File

@ -19,8 +19,8 @@ This package contains the complete taxonomic tree of almost all microorganisms (
Included are: Included are:
\itemize{ \itemize{
\item All ~55,000 (sub)species from the kingdoms of Archaea, Bacteria, Chromista and Protozoa \item All ~55,000 (sub)species from the kingdoms of Archaea, Bacteria, Chromista and Protozoa
\item All ~5,000 (sub)species from these orders of the kingdom of Fungi: Eurotiales, Microascales, Mucorales, Onygenales, Pneumocystales, Saccharomycetales, Schizosaccharomycetales and Tremellales, as well as ~4,600 other fungal (sub)species. The kingdom of Fungi is a very large taxon with almost 300,000 different (sub)species, of which most are not microbial (but rather macroscopic, like mushrooms). Because of this, not all fungi fit the scope of this package and including everything would tremendously slow down our algorithms too. By only including the aforementioned taxonomic orders, the most relevant fungi are covered (like all species of \emph{Aspergillus}, \emph{Candida}, \emph{Cryptococcus}, \emph{Histplasma}, \emph{Pneumocystis}, \emph{Saccharomyces} and \emph{Trichophyton}). \item All ~5,000 (sub)species from these orders of the kingdom of Fungi: Eurotiales, Microascales, Mucorales, Onygenales, Pneumocystales, Saccharomycetales, Schizosaccharomycetales and Tremellales, as well as ~4,600 other fungal (sub)species. The kingdom of Fungi is a very large taxon with almost 300,000 different (sub)species, of which most are not microbial (but rather macroscopic, like mushrooms). Because of this, not all fungi fit the scope of this package and including everything would tremendously slow down our algorithms too. By only including the aforementioned taxonomic orders, the most relevant fungi are covered (such as all species of \emph{Aspergillus}, \emph{Candida}, \emph{Cryptococcus}, \emph{Histplasma}, \emph{Pneumocystis}, \emph{Saccharomyces} and \emph{Trichophyton}).
\item All ~2,200 (sub)species from ~50 other relevant genera from the kingdom of Animalia (like \emph{Strongyloides} and \emph{Taenia}) \item All ~2,200 (sub)species from ~50 other relevant genera from the kingdom of Animalia (such as \emph{Strongyloides} and \emph{Taenia})
\item All ~13,000 previously accepted names of all included (sub)species (these were taxonomically renamed) \item All ~13,000 previously accepted names of all included (sub)species (these were taxonomically renamed)
\item The complete taxonomic tree of all included (sub)species: from kingdom to subspecies \item The complete taxonomic tree of all included (sub)species: from kingdom to subspecies
\item The responsible author(s) and year of scientific publication \item The responsible author(s) and year of scientific publication

View File

@ -47,11 +47,11 @@ count_df(
\item{data}{a \link{data.frame} containing columns with class \code{\link{rsi}} (see \code{\link[=as.rsi]{as.rsi()}})} \item{data}{a \link{data.frame} containing columns with class \code{\link{rsi}} (see \code{\link[=as.rsi]{as.rsi()}})}
\item{translate_ab}{a column name of the \link{antibiotics} data set to translate the antibiotic abbreviations to, using \code{\link[=ab_property]{ab_property()}}. Use a value} \item{translate_ab}{a column name of the \link{antibiotics} data set to translate the antibiotic abbreviations to, using \code{\link[=ab_property]{ab_property()}}}
\item{language}{language of the returned text, defaults to system language (see \code{\link[=get_locale]{get_locale()}}) and can also be set with \code{getOption("AMR_locale")}. Use \code{language = NULL} or \code{language = ""} to prevent translation.} \item{language}{language of the returned text, defaults to system language (see \code{\link[=get_locale]{get_locale()}}) and can also be set with \code{getOption("AMR_locale")}. Use \code{language = NULL} or \code{language = ""} to prevent translation.}
\item{combine_SI}{a logical to indicate whether all values of S and I must be merged into one, so the output only consists of S+I vs. R (susceptible vs. resistant). This used to be the parameter \code{combine_IR}, but this now follows the redefinition by EUCAST about the interpretion of I (increased exposure) in 2019, see section 'Interpretation of S, I and R' below. Default is \code{TRUE}.} \item{combine_SI}{a logical to indicate whether all values of S and I must be merged into one, so the output only consists of S+I vs. R (susceptible vs. resistant). This used to be the parameter \code{combine_IR}, but this now follows the redefinition by EUCAST about the interpretation of I (increased exposure) in 2019, see section 'Interpretation of S, I and R' below. Default is \code{TRUE}.}
\item{combine_IR}{a logical to indicate whether all values of I and R must be merged into one, so the output only consists of S vs. I+R (susceptible vs. non-susceptible). This is outdated, see parameter \code{combine_SI}.} \item{combine_IR}{a logical to indicate whether all values of I and R must be merged into one, so the output only consists of S vs. I+R (susceptible vs. non-susceptible). This is outdated, see parameter \code{combine_SI}.}
} }

View File

@ -58,7 +58,7 @@ filter_first_weighted_isolate(
\item{col_mo}{column name of the IDs of the microorganisms (see \code{\link[=as.mo]{as.mo()}}), defaults to the first column of class \code{\link{mo}}. Values will be coerced using \code{\link[=as.mo]{as.mo()}}.} \item{col_mo}{column name of the IDs of the microorganisms (see \code{\link[=as.mo]{as.mo()}}), defaults to the first column of class \code{\link{mo}}. Values will be coerced using \code{\link[=as.mo]{as.mo()}}.}
\item{col_testcode}{column name of the test codes. Use \code{col_testcode = NULL} to \strong{not} exclude certain test codes (like test codes for screening). In that case \code{testcodes_exclude} will be ignored.} \item{col_testcode}{column name of the test codes. Use \code{col_testcode = NULL} to \strong{not} exclude certain test codes (such as test codes for screening). In that case \code{testcodes_exclude} will be ignored.}
\item{col_specimen}{column name of the specimen type or group} \item{col_specimen}{column name of the specimen type or group}

View File

@ -58,7 +58,7 @@ If \code{x} is a matrix with at least two rows and columns, it is taken as a two
The p-value is computed from the asymptotic chi-squared distribution of the test statistic. The p-value is computed from the asymptotic chi-squared distribution of the test statistic.
In the contingency table case simulation is done by random sampling from the set of all contingency tables with given marginals, and works only if the marginals are strictly positive. Note that this is not the usual sampling situation assumed for a chi-squared test (like the \emph{G}-test) but rather that for Fisher's exact test. In the contingency table case simulation is done by random sampling from the set of all contingency tables with given marginals, and works only if the marginals are strictly positive. Note that this is not the usual sampling situation assumed for a chi-squared test (such as the \emph{G}-test) but rather that for Fisher's exact test.
In the goodness-of-fit case simulation is done by random sampling from the discrete distribution specified by \code{p}, each sample being of size \code{n = sum(x)}. This simulation is done in \R and may be slow. In the goodness-of-fit case simulation is done by random sampling from the discrete distribution specified by \code{p}, each sample being of size \code{n = sum(x)}. This simulation is done in \R and may be slow.
\subsection{\emph{G}-test of goodness-of-fit (likelihood ratio test)}{ \subsection{\emph{G}-test of goodness-of-fit (likelihood ratio test)}{

View File

@ -87,9 +87,9 @@ labels_rsi_count(
\item{limits}{numeric vector of length two providing limits of the scale, use \code{NA} to refer to the existing minimum or maximum} \item{limits}{numeric vector of length two providing limits of the scale, use \code{NA} to refer to the existing minimum or maximum}
\item{translate_ab}{a column name of the \link{antibiotics} data set to translate the antibiotic abbreviations to, using \code{\link[=ab_property]{ab_property()}}. Use a value} \item{translate_ab}{a column name of the \link{antibiotics} data set to translate the antibiotic abbreviations to, using \code{\link[=ab_property]{ab_property()}}}
\item{combine_SI}{a logical to indicate whether all values of S and I must be merged into one, so the output only consists of S+I vs. R (susceptible vs. resistant). This used to be the parameter \code{combine_IR}, but this now follows the redefinition by EUCAST about the interpretion of I (increased exposure) in 2019, see section 'Interpretation of S, I and R' below. Default is \code{TRUE}.} \item{combine_SI}{a logical to indicate whether all values of S and I must be merged into one, so the output only consists of S+I vs. R (susceptible vs. resistant). This used to be the parameter \code{combine_IR}, but this now follows the redefinition by EUCAST about the interpretation of I (increased exposure) in 2019, see section 'Interpretation of S, I and R' below. Default is \code{TRUE}.}
\item{combine_IR}{a logical to indicate whether all values of I and R must be merged into one, so the output only consists of S vs. I+R (susceptible vs. non-susceptible). This is outdated, see parameter \code{combine_SI}.} \item{combine_IR}{a logical to indicate whether all values of I and R must be merged into one, so the output only consists of S vs. I+R (susceptible vs. non-susceptible). This is outdated, see parameter \code{combine_SI}.}

View File

@ -26,7 +26,7 @@ anti_join_microorganisms(x, by = NULL, ...)
\arguments{ \arguments{
\item{x}{existing table to join, or character vector} \item{x}{existing table to join, or character vector}
\item{by}{a variable to join by - if left empty will search for a column with class \code{\link{mo}} (created with \code{\link[=as.mo]{as.mo()}}) or will be \code{"mo"} if that column name exists in \code{x}, could otherwise be a column name of \code{x} with values that exist in \code{microorganisms$mo} (like \code{by = "bacteria_id"}), or another column in \link{microorganisms} (but then it should be named, like \code{by = c("bacteria_id" = "fullname")})} \item{by}{a variable to join by - if left empty will search for a column with class \code{\link{mo}} (created with \code{\link[=as.mo]{as.mo()}}) or will be \code{"mo"} if that column name exists in \code{x}, could otherwise be a column name of \code{x} with values that exist in \code{microorganisms$mo} (such as \code{by = "bacteria_id"}), or another column in \link{microorganisms} (but then it should be named, like \code{by = c("bacteria_id" = "fullname")})}
\item{suffix}{if there are non-joined duplicate variables in \code{x} and \code{y}, these suffixes will be added to the output to disambiguate them. Should be a character vector of length 2.} \item{suffix}{if there are non-joined duplicate variables in \code{x} and \code{y}, these suffixes will be added to the output to disambiguate them. Should be a character vector of length 2.}

View File

@ -117,7 +117,7 @@ All functions will return the most recently known taxonomic property according t
\item \code{mo_ref("Shimwellia blattae")} will return \code{"Priest et al., 2010"} (without a message) \item \code{mo_ref("Shimwellia blattae")} will return \code{"Priest et al., 2010"} (without a message)
} }
The short name - \code{\link[=mo_shortname]{mo_shortname()}} - almost always returns the first character of the genus and the full species, like \code{"E. coli"}. Exceptions are abbreviations of staphylococci (like \emph{"CoNS"}, Coagulase-Negative Staphylococci) and beta-haemolytic streptococci (like \emph{"GBS"}, Group B Streptococci). Please bear in mind that e.g. \emph{E. coli} could mean \emph{Escherichia coli} (kingdom of Bacteria) as well as \emph{Entamoeba coli} (kingdom of Protozoa). Returning to the full name will be done using \code{\link[=as.mo]{as.mo()}} internally, giving priority to bacteria and human pathogens, i.e. \code{"E. coli"} will be considered \emph{Escherichia coli}. In other words, \code{mo_fullname(mo_shortname("Entamoeba coli"))} returns \code{"Escherichia coli"}. The short name - \code{\link[=mo_shortname]{mo_shortname()}} - almost always returns the first character of the genus and the full species, like \code{"E. coli"}. Exceptions are abbreviations of staphylococci (such as \emph{"CoNS"}, Coagulase-Negative Staphylococci) and beta-haemolytic streptococci (such as \emph{"GBS"}, Group B Streptococci). Please bear in mind that e.g. \emph{E. coli} could mean \emph{Escherichia coli} (kingdom of Bacteria) as well as \emph{Entamoeba coli} (kingdom of Protozoa). Returning to the full name will be done using \code{\link[=as.mo]{as.mo()}} internally, giving priority to bacteria and human pathogens, i.e. \code{"E. coli"} will be considered \emph{Escherichia coli}. In other words, \code{mo_fullname(mo_shortname("Entamoeba coli"))} returns \code{"Escherichia coli"}.
Since the top-level of the taxonomy is sometimes referred to as 'kingdom' and sometimes as 'domain', the functions \code{\link[=mo_kingdom]{mo_kingdom()}} and \code{\link[=mo_domain]{mo_domain()}} return the exact same results. Since the top-level of the taxonomy is sometimes referred to as 'kingdom' and sometimes as 'domain', the functions \code{\link[=mo_kingdom]{mo_kingdom()}} and \code{\link[=mo_domain]{mo_domain()}} return the exact same results.

View File

@ -6,12 +6,17 @@
\alias{get_mo_source} \alias{get_mo_source}
\title{User-defined reference data set for microorganisms} \title{User-defined reference data set for microorganisms}
\usage{ \usage{
set_mo_source(path) set_mo_source(
path,
destination = getOption("AMR_mo_source", "~/mo_source.rds")
)
get_mo_source() get_mo_source(destination = getOption("AMR_mo_source", "~/mo_source.rds"))
} }
\arguments{ \arguments{
\item{path}{location of your reference file, see Details. Can be \code{""}, \code{NULL} or \code{FALSE} to delete the reference file.} \item{path}{location of your reference file, see Details. Can be \code{""}, \code{NULL} or \code{FALSE} to delete the reference file.}
\item{destination}{destination of the compressed data file, default to the user's home directory.}
} }
\description{ \description{
These functions can be used to predefine your own reference to be used in \code{\link[=as.mo]{as.mo()}} and consequently all \verb{mo_*} functions like \code{\link[=mo_genus]{mo_genus()}} and \code{\link[=mo_gramstain]{mo_gramstain()}}. These functions can be used to predefine your own reference to be used in \code{\link[=as.mo]{as.mo()}} and consequently all \verb{mo_*} functions like \code{\link[=mo_genus]{mo_genus()}} and \code{\link[=mo_gramstain]{mo_gramstain()}}.
@ -21,11 +26,11 @@ This is \strong{the fastest way} to have your organisation (or analysis) specifi
\details{ \details{
The reference file can be a text file separated with commas (CSV) or tabs or pipes, an Excel file (either 'xls' or 'xlsx' format) or an R object file (extension '.rds'). To use an Excel file, you will need to have the \code{readxl} package installed. The reference file can be a text file separated with commas (CSV) or tabs or pipes, an Excel file (either 'xls' or 'xlsx' format) or an R object file (extension '.rds'). To use an Excel file, you will need to have the \code{readxl} package installed.
\code{\link[=set_mo_source]{set_mo_source()}} will check the file for validity: it must be a \link{data.frame}, must have a column named \code{"mo"} which contains values from \code{\link[=microorganisms]{microorganisms$mo}} and must have a reference column with your own defined values. If all tests pass, \code{\link[=set_mo_source]{set_mo_source()}} will read the file into R and will ask to export it to \code{"~/.mo_source.rds"}. The CRAN policy disallows packages to write to the file system, although '\emph{exceptions may be allowed in interactive sessions if the package obtains confirmation from the user}'. For this reason, this function only works in interactive sessions so that the user can \strong{specifically confirm and allow} that this file will be created. \code{\link[=set_mo_source]{set_mo_source()}} will check the file for validity: it must be a \link{data.frame}, must have a column named \code{"mo"} which contains values from \code{\link[=microorganisms]{microorganisms$mo}} and must have a reference column with your own defined values. If all tests pass, \code{\link[=set_mo_source]{set_mo_source()}} will read the file into R and will ask to export it to \code{"~/mo_source.rds"}. The CRAN policy disallows packages to write to the file system, although '\emph{exceptions may be allowed in interactive sessions if the package obtains confirmation from the user}'. For this reason, this function only works in interactive sessions so that the user can \strong{specifically confirm and allow} that this file will be created. The destination of this file can be set with the \code{destination} parameter and defaults to the user's home directory. It can also be set as an \R option, using \verb{options(AMR_mo_source = "my/location/file.rds)}.
The created compressed data file \code{"~/.mo_source.rds"} will be used at default for MO determination (function \code{\link[=as.mo]{as.mo()}} and consequently all \verb{mo_*} functions like \code{\link[=mo_genus]{mo_genus()}} and \code{\link[=mo_gramstain]{mo_gramstain()}}). The location of the original file will be saved as an R option with \code{options(mo_source = path)}. Its timestamp will be saved with \code{options(mo_source_datetime = ...)}. The created compressed data file \code{"mo_source.rds"} will be used at default for MO determination (function \code{\link[=as.mo]{as.mo()}} and consequently all \verb{mo_*} functions like \code{\link[=mo_genus]{mo_genus()}} and \code{\link[=mo_gramstain]{mo_gramstain()}}). The location and timestamp of the original file will be saved as an attribute to the compressed data file.
The function \code{\link[=get_mo_source]{get_mo_source()}} will return the data set by reading \code{"~/.mo_source.rds"} with \code{\link[=readRDS]{readRDS()}}. If the original file has changed (by checking the aforementioned options \code{mo_source} and \code{mo_source_datetime}), it will call \code{\link[=set_mo_source]{set_mo_source()}} to update the data file automatically if used in an interactive session. The function \code{\link[=get_mo_source]{get_mo_source()}} will return the data set by reading \code{"mo_source.rds"} with \code{\link[=readRDS]{readRDS()}}. If the original file has changed (by checking the location and timestamp of the original file), it will call \code{\link[=set_mo_source]{set_mo_source()}} to update the data file automatically if used in an interactive session.
Reading an Excel file (\code{.xlsx}) with only one row has a size of 8-9 kB. The compressed file created with \code{\link[=set_mo_source]{set_mo_source()}} will then have a size of 0.1 kB and can be read by \code{\link[=get_mo_source]{get_mo_source()}} in only a couple of microseconds (millionths of a second). Reading an Excel file (\code{.xlsx}) with only one row has a size of 8-9 kB. The compressed file created with \code{\link[=set_mo_source]{set_mo_source()}} will then have a size of 0.1 kB and can be read by \code{\link[=get_mo_source]{get_mo_source()}} in only a couple of microseconds (millionths of a second).
} }
@ -41,13 +46,15 @@ Imagine this data on a sheet of an Excel file (mo codes were looked up in the \l
} }
We save it as \code{"home/me/ourcodes.xlsx"}. Now we have to set it as a source:\preformatted{set_mo_source("home/me/ourcodes.xlsx") We save it as \code{"home/me/ourcodes.xlsx"}. Now we have to set it as a source:\preformatted{set_mo_source("home/me/ourcodes.xlsx")
#> NOTE: Created mo_source file '~/.mo_source.rds' from 'home/me/ourcodes.xlsx' #> NOTE: Created mo_source file '/Users/me/mo_source.rds' (0.3 kB) from
#> (columns "Organisation XYZ" and "mo") #> '/Users/me/Documents/ourcodes.xlsx' (9 kB), columns
#> "Organisation XYZ" and "mo"
} }
It has now created a file \code{"~/.mo_source.rds"} with the contents of our Excel file. Only the first column with foreign values and the 'mo' column will be kept when creating the RDS file. It has now created a file \code{"~/mo_source.rds"} with the contents of our Excel file. Only the first column with foreign values and the 'mo' column will be kept when creating the RDS file.
And now we can use it in our functions:\preformatted{as.mo("lab_mo_ecoli") And now we can use it in our functions:\preformatted{as.mo("lab_mo_ecoli")
#> Class <mo>
#> [1] B_ESCHR_COLI #> [1] B_ESCHR_COLI
mo_genus("lab_mo_kpneumoniae") mo_genus("lab_mo_kpneumoniae")
@ -55,6 +62,9 @@ mo_genus("lab_mo_kpneumoniae")
# other input values still work too # other input values still work too
as.mo(c("Escherichia coli", "E. coli", "lab_mo_ecoli")) as.mo(c("Escherichia coli", "E. coli", "lab_mo_ecoli"))
#> NOTE: Translation to one microorganism was guessed with uncertainty.
#> Use mo_uncertainties() to review it.
#> Class <mo>
#> [1] B_ESCHR_COLI B_ESCHR_COLI B_ESCHR_COLI #> [1] B_ESCHR_COLI B_ESCHR_COLI B_ESCHR_COLI
} }
@ -68,8 +78,10 @@ If we edit the Excel file by, let's say, adding row 4 like this:\preformatted{
} }
...any new usage of an MO function in this package will update your data file:\preformatted{as.mo("lab_mo_ecoli") ...any new usage of an MO function in this package will update your data file:\preformatted{as.mo("lab_mo_ecoli")
#> NOTE: Updated mo_source file '~/.mo_source.rds' from 'home/me/ourcodes.xlsx' #> NOTE: Updated mo_source file '/Users/me/mo_source.rds' (0.3 kB) from
#> (columns "Organisation XYZ" and "mo") #> '/Users/me/Documents/ourcodes.xlsx' (9 kB), columns
#> "Organisation XYZ" and "mo"
#> Class <mo>
#> [1] B_ESCHR_COLI #> [1] B_ESCHR_COLI
mo_genus("lab_Staph_aureus") mo_genus("lab_Staph_aureus")
@ -77,10 +89,10 @@ mo_genus("lab_Staph_aureus")
} }
To delete the reference data file, just use \code{""}, \code{NULL} or \code{FALSE} as input for \code{\link[=set_mo_source]{set_mo_source()}}:\preformatted{set_mo_source(NULL) To delete the reference data file, just use \code{""}, \code{NULL} or \code{FALSE} as input for \code{\link[=set_mo_source]{set_mo_source()}}:\preformatted{set_mo_source(NULL)
# Removed mo_source file '~/.mo_source.rds'. #> Removed mo_source file '/Users/me/mo_source.rds'
} }
If the original Excel file is moved or deleted, the mo_source file will be removed upon the next use of \code{\link[=as.mo]{as.mo()}}. If the mo_source file is manually deleted (i.e. without using \code{\link[=set_mo_source]{set_mo_source()}}), the references to the mo_source file will be removed upon the next use of \code{\link[=as.mo]{as.mo()}}. If the original Excel file is moved or deleted, the mo_source file will be removed upon the next use of \code{\link[=as.mo]{as.mo()}}.
} }
\section{Stable lifecycle}{ \section{Stable lifecycle}{

View File

@ -62,11 +62,11 @@ rsi_df(
\item{data}{a \link{data.frame} containing columns with class \code{\link{rsi}} (see \code{\link[=as.rsi]{as.rsi()}})} \item{data}{a \link{data.frame} containing columns with class \code{\link{rsi}} (see \code{\link[=as.rsi]{as.rsi()}})}
\item{translate_ab}{a column name of the \link{antibiotics} data set to translate the antibiotic abbreviations to, using \code{\link[=ab_property]{ab_property()}}. Use a value} \item{translate_ab}{a column name of the \link{antibiotics} data set to translate the antibiotic abbreviations to, using \code{\link[=ab_property]{ab_property()}}}
\item{language}{language of the returned text, defaults to system language (see \code{\link[=get_locale]{get_locale()}}) and can also be set with \code{getOption("AMR_locale")}. Use \code{language = NULL} or \code{language = ""} to prevent translation.} \item{language}{language of the returned text, defaults to system language (see \code{\link[=get_locale]{get_locale()}}) and can also be set with \code{getOption("AMR_locale")}. Use \code{language = NULL} or \code{language = ""} to prevent translation.}
\item{combine_SI}{a logical to indicate whether all values of S and I must be merged into one, so the output only consists of S+I vs. R (susceptible vs. resistant). This used to be the parameter \code{combine_IR}, but this now follows the redefinition by EUCAST about the interpretion of I (increased exposure) in 2019, see section 'Interpretation of S, I and R' below. Default is \code{TRUE}.} \item{combine_SI}{a logical to indicate whether all values of S and I must be merged into one, so the output only consists of S+I vs. R (susceptible vs. resistant). This used to be the parameter \code{combine_IR}, but this now follows the redefinition by EUCAST about the interpretation of I (increased exposure) in 2019, see section 'Interpretation of S, I and R' below. Default is \code{TRUE}.}
\item{combine_IR}{a logical to indicate whether all values of I and R must be merged into one, so the output only consists of S vs. I+R (susceptible vs. non-susceptible). This is outdated, see parameter \code{combine_SI}.} \item{combine_IR}{a logical to indicate whether all values of I and R must be merged into one, so the output only consists of S vs. I+R (susceptible vs. non-susceptible). This is outdated, see parameter \code{combine_SI}.}
} }

View File

@ -63,7 +63,7 @@ ggplot_rsi_predict(
\item{model}{the statistical model of choice. This could be a generalised linear regression model with binomial distribution (i.e. using `glm(..., family = binomial)``, assuming that a period of zero resistance was followed by a period of increasing resistance leading slowly to more and more resistance. See Details for all valid options.} \item{model}{the statistical model of choice. This could be a generalised linear regression model with binomial distribution (i.e. using `glm(..., family = binomial)``, assuming that a period of zero resistance was followed by a period of increasing resistance leading slowly to more and more resistance. See Details for all valid options.}
\item{I_as_S}{a logical to indicate whether values \code{I} should be treated as \code{S} (will otherwise be treated as \code{R}). The default, \code{TRUE}, follows the redefinition by EUCAST about the interpretion of I (increased exposure) in 2019, see section \emph{Interpretation of S, I and R} below.} \item{I_as_S}{a logical to indicate whether values \code{"I"} should be treated as \code{"S"} (will otherwise be treated as \code{"R"}). The default, \code{TRUE}, follows the redefinition by EUCAST about the interpretation of I (increased exposure) in 2019, see section \emph{Interpretation of S, I and R} below.}
\item{preserve_measurements}{a logical to indicate whether predictions of years that are actually available in the data should be overwritten by the original data. The standard errors of those years will be \code{NA}.} \item{preserve_measurements}{a logical to indicate whether predictions of years that are actually available in the data should be overwritten by the original data. The standard errors of those years will be \code{NA}.}

View File

@ -11,7 +11,7 @@ get_locale()
For language-dependent output of AMR functions, like \code{\link[=mo_name]{mo_name()}}, \code{\link[=mo_gramstain]{mo_gramstain()}}, \code{\link[=mo_type]{mo_type()}} and \code{\link[=ab_name]{ab_name()}}. For language-dependent output of AMR functions, like \code{\link[=mo_name]{mo_name()}}, \code{\link[=mo_gramstain]{mo_gramstain()}}, \code{\link[=mo_type]{mo_type()}} and \code{\link[=ab_name]{ab_name()}}.
} }
\details{ \details{
Strings will be translated to foreign languages if they are defined in a local translation file. Additions to this file can be suggested at our repository. The file can be found here: \url{https://github.com/msberends/AMR/blob/master/data-raw/translations.tsv}. This file will be read by all functions where a translated output can be desired, like all \code{\link[=mo_property]{mo_property()}} functions (\code{\link[=mo_name]{mo_name()}}, \code{\link[=mo_gramstain]{mo_gramstain()}}, \code{\link[=mo_type]{mo_type()}}, etc.) and \code{\link[=ab_property]{ab_property()}} functions (\code{\link[=ab_name]{ab_name()}}, \code{\link[=ab_group]{ab_group()}} etc.). Strings will be translated to foreign languages if they are defined in a local translation file. Additions to this file can be suggested at our repository. The file can be found here: \url{https://github.com/msberends/AMR/blob/master/data-raw/translations.tsv}. This file will be read by all functions where a translated output can be desired, like all \code{\link[=mo_property]{mo_*}} functions (such as \code{\link[=mo_name]{mo_name()}}, \code{\link[=mo_gramstain]{mo_gramstain()}}, \code{\link[=mo_type]{mo_type()}}, etc.) and \code{\link[=ab_property]{ab_*}} functions (such as \code{\link[=ab_name]{ab_name()}}, \code{\link[=ab_group]{ab_group()}}, etc.).
Currently supported languages are: Dutch, English, French, German, Italian, Portuguese, Spanish. Please note that currently not all these languages have translations available for all antimicrobial agents and colloquial microorganism names. Currently supported languages are: Dutch, English, French, German, Italian, Portuguese, Spanish. Please note that currently not all these languages have translations available for all antimicrobial agents and colloquial microorganism names.

View File

@ -108,13 +108,13 @@ test_that("mic2rsi works", {
as.rsi("S")) as.rsi("S"))
expect_equal(as.rsi(as.mic(32), "E. coli", "ampicillin", guideline = "EUCAST 2020"), expect_equal(as.rsi(as.mic(32), "E. coli", "ampicillin", guideline = "EUCAST 2020"),
as.rsi("R")) as.rsi("R"))
expect_true(example_isolates %>% expect_true(suppressWarnings(example_isolates %>%
mutate(amox_mic = as.mic(2)) %>% mutate(amox_mic = as.mic(2)) %>%
select(mo, amox_mic) %>% select(mo, amox_mic) %>%
as.rsi() %>% as.rsi() %>%
pull(amox_mic) %>% pull(amox_mic) %>%
is.rsi()) is.rsi()))
expect_warning(data.frame(mo = "E. coli", expect_warning(data.frame(mo = "E. coli",
NIT = c("<= 2", 32)) %>% NIT = c("<= 2", 32)) %>%

View File

@ -28,6 +28,8 @@ context("zzz.R")
test_that("imports work", { test_that("imports work", {
skip_on_cran() skip_on_cran()
# Check if these function still exist in the package (all are in Suggests field)
# Since GitHub Action runs every night, we will be emailed when a dependency fails based on this unit test
import_functions <- c( import_functions <- c(
"anti_join" = "dplyr", "anti_join" = "dplyr",
"cur_column" = "dplyr", "cur_column" = "dplyr",
@ -47,11 +49,8 @@ test_that("imports work", {
"inline_hist" = "skimr", "inline_hist" = "skimr",
"inner_join" = "dplyr", "inner_join" = "dplyr",
"insertText" = "rstudioapi", "insertText" = "rstudioapi",
"insertText" = "rstudioapi",
"insertText" = "rstudioapi",
"left_join" = "dplyr", "left_join" = "dplyr",
"new_pillar_shaft_simple" = "pillar", "new_pillar_shaft_simple" = "pillar",
"peek_mask" = "dplyr",
"peek_vars" = "tidyselect", "peek_vars" = "tidyselect",
"read_excel" = "readxl", "read_excel" = "readxl",
"read_html" = "xml2", "read_html" = "xml2",

View File

@ -26,15 +26,6 @@ library(dplyr)
options(knitr.kable.NA = '') options(knitr.kable.NA = '')
file_size <- function(...) {
size_kb <- file.size(...) / 1024
if (size_kb < 100) {
paste(round(size_kb, 0), "kB")
} else {
paste(round(size_kb / 1024, 1), "MB")
}
}
structure_txt <- function(dataset) { structure_txt <- function(dataset) {
paste0("A data set with ", paste0("A data set with ",
format(nrow(dataset), big.mark = ","), " rows and ", format(nrow(dataset), big.mark = ","), " rows and ",
@ -55,7 +46,7 @@ download_txt <- function(filename) {
sas <- paste0(filename, ".sas") sas <- paste0(filename, ".sas")
excel <- paste0(filename, ".xlsx") excel <- paste0(filename, ".xlsx")
create_txt <- function(filename, type, software) { create_txt <- function(filename, type, software) {
paste0("* Download as [", software, " file](", github_base, filename, ") (", file_size(filename), ") \n") paste0("* Download as [", software, " file](", github_base, filename, ") (", AMR:::formatted_filesize(filename), ") \n")
} }
if (any(file.exists(rds), if (any(file.exists(rds),
@ -83,7 +74,7 @@ print_df <- function(x, rows = 6) {
sapply(x, function(y) { sapply(x, function(y) {
if (length(y) > 3) { if (length(y) > 3) {
paste0(paste(y[1:3], collapse = ", "), ", ...") paste0(paste(y[1:3], collapse = ", "), ", ...")
} else if (length(y) == 0 || is.na(y)) { } else if (length(y) == 0 || all(is.na(y))) {
"" ""
} else { } else {
paste(y, collapse = ", ") paste(y, collapse = ", ")