diff --git a/.github/prehooks/pre-commit b/.github/prehooks/pre-commit index 12d23293..6814b90f 100755 --- a/.github/prehooks/pre-commit +++ b/.github/prehooks/pre-commit @@ -13,9 +13,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/.github/workflows/check-current.yaml b/.github/workflows/check-current.yaml index 03ed53ee..261cca9c 100644 --- a/.github/workflows/check-current.yaml +++ b/.github/workflows/check-current.yaml @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/.github/workflows/check-old.yaml b/.github/workflows/check-old.yaml index 23270b07..ad8ec904 100644 --- a/.github/workflows/check-old.yaml +++ b/.github/workflows/check-old.yaml @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/.github/workflows/codecovr.yaml b/.github/workflows/codecovr.yaml index 2fd237a0..08ccea5c 100644 --- a/.github/workflows/codecovr.yaml +++ b/.github/workflows/codecovr.yaml @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/.github/workflows/lintr.yaml b/.github/workflows/lintr.yaml index 00f06381..12f2e71d 100644 --- a/.github/workflows/lintr.yaml +++ b/.github/workflows/lintr.yaml @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/.github/workflows/website.yaml b/.github/workflows/website.yaml index f753ded7..c128221f 100644 --- a/.github/workflows/website.yaml +++ b/.github/workflows/website.yaml @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/DESCRIPTION b/DESCRIPTION index 72ce4665..7fd5548b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 1.8.2.9069 -Date: 2022-12-21 +Version: 1.8.2.9070 +Date: 2022-12-27 Title: Antimicrobial Resistance Data Analysis Description: Functions to simplify and standardise antimicrobial resistance (AMR) data analysis and to work with microbial and antimicrobial properties by diff --git a/NAMESPACE b/NAMESPACE index 439e2885..2dbd4df3 100755 --- a/NAMESPACE +++ b/NAMESPACE @@ -191,6 +191,7 @@ export(ab_synonyms) export(ab_tradenames) export(ab_url) export(add_custom_antimicrobials) +export(add_custom_microorganisms) export(administrable_iv) export(administrable_per_os) export(age) @@ -238,6 +239,7 @@ export(cephalosporins_3rd) export(cephalosporins_4th) export(cephalosporins_5th) export(clear_custom_antimicrobials) +export(clear_custom_microorganisms) export(count_I) export(count_IR) export(count_R) diff --git a/NEWS.md b/NEWS.md index bb841ba6..6a354457 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 1.8.2.9069 +# AMR 1.8.2.9070 *(this beta version will eventually become v2.0! We're happy to reach a new major milestone soon!)* diff --git a/R/aa_globals.R b/R/aa_globals.R index b623a907..b3eb77bd 100755 --- a/R/aa_globals.R +++ b/R/aa_globals.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/aa_helper_functions.R b/R/aa_helper_functions.R index c4642843..024927fa 100755 --- a/R/aa_helper_functions.R +++ b/R/aa_helper_functions.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # @@ -1375,6 +1375,13 @@ trimws2 <- function(..., whitespace = "[\u0009\u000A\u000B\u000C\u000D\u0020\u00 trimws(..., whitespace = whitespace) } +readRDS2 <- function(file, refhook = NULL) { + # this is readRDS with remote file support + con <- file(file) + on.exit(close(con)) + readRDS(con, refhook = refhook) +} + # Faster data.table implementations ---- match <- function(x, table, ...) { diff --git a/R/aa_helper_pm_functions.R b/R/aa_helper_pm_functions.R index 32d182c1..2ad3ea12 100644 --- a/R/aa_helper_pm_functions.R +++ b/R/aa_helper_pm_functions.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/ab.R b/R/ab.R index 495f8c0e..deaba68f 100755 --- a/R/ab.R +++ b/R/ab.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/ab_from_text.R b/R/ab_from_text.R index 92d0a16e..76dda691 100644 --- a/R/ab_from_text.R +++ b/R/ab_from_text.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/ab_property.R b/R/ab_property.R index 830a5491..57a98b5d 100644 --- a/R/ab_property.R +++ b/R/ab_property.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/ab_selectors.R b/R/ab_selectors.R index 8bb482d9..89d2d753 100644 --- a/R/ab_selectors.R +++ b/R/ab_selectors.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/add_custom_antimicrobials.R b/R/add_custom_antimicrobials.R index bf7eedc6..158f6911 100644 --- a/R/add_custom_antimicrobials.R +++ b/R/add_custom_antimicrobials.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # @@ -31,22 +31,41 @@ #' #' With [add_custom_antimicrobials()] you can add your own custom antimicrobial drug codes to the `AMR` package. #' @param x a [data.frame] resembling the [antibiotics] data set, at least containing columns "ab" and "name" -#' @details Due to how \R works, the [add_custom_antimicrobials()] function has to be run in every \R session - added antimicrobials are not stored between sessions and are thus lost when \R is exited. It is possible to save the antimicrobial additions to your `.Rprofile` file to circumvent this, although this requires to load the `AMR` package at every start-up: +#' @details **Important:** Due to how \R works, the [add_custom_antimicrobials()] function has to be run in every \R session - added antimicrobials are not stored between sessions and are thus lost when \R is exited. +#' +#' There are two ways to automate this process: +#' +#' **Method 1:** Save the antimicrobials to a local or remote file (can even be the internet). To use this method: +#' +#' 1. Create a data set in the structure of the [antibiotics] data set (containing at the very least columns "ab" and "name") and save it with [saveRDS()] to a location of choice, e.g. `"~/my_custom_ab.rds"`, or any remote location. +#' +#' 2. Set the file location to the `AMR_custom_ab` \R option: `options(AMR_custom_ab = "~/my_custom_ab.rds")`. This can even be a remote file location, such as an https URL. Since options are not saved between \R sessions, it is best to save this option to the `.Rprofile` file so that it will loaded on start-up of \R. To do this, open the `.Rprofile` file using e.g. `utils::file.edit("~/.Rprofile")`, add this text and save the file: #' -#' ```r -#' # Open .Rprofile file -#' utils::file.edit("~/.Rprofile") +#' ```r +#' # Add custom antibiotic drug codes: +#' options(AMR_custom_ab = "~/my_custom_ab.rds") +#' ``` +#' +#' Upon package load, this file will be loaded and run through the [add_custom_antimicrobials()] function. +#' +#' **Method 2:** Save the antimicrobial additions directly to your `.Rprofile` file. An important downside is that this requires to load the `AMR` package at every start-up. To use this method: +#' +#' 1. Edit the `.Rprofile` file using e.g. `utils::file.edit("~/.Rprofile")`. #' -#' # Add custom antibiotic drug codes: -#' library(AMR) -#' add_custom_antimicrobials( -#' data.frame(ab = "TESTAB", -#' name = "Test Antibiotic", -#' group = "Test Group") -#' ) -#' ``` +#' 2. Add a text like below and save the file: +#' +#' ```r +#' # Add custom antibiotic drug codes: +#' library(AMR) +#' add_custom_antimicrobials( +#' data.frame(ab = "TESTAB", +#' name = "Test Antibiotic", +#' group = "Test Group") +#' ) +#' ``` #' #' Use [clear_custom_antimicrobials()] to clear the previously added antimicrobials. +#' @seealso [add_custom_microorganisms()] to add custom microorganisms to this package. #' @rdname add_custom_antimicrobials #' @export #' @examples @@ -84,7 +103,7 @@ #' ab = "COFLU", #' name = "Co-fluampicil", #' atc = "J01CR50", -#' group = "Beta-lactams/penicillines" +#' group = "Beta-lactams/penicillins" #' ) #' ) #' ab_atc("Co-fluampicil") @@ -109,19 +128,21 @@ add_custom_antimicrobials <- function(x) { any(x$ab %in% AMR_env$AB_lookup$ab), "Antimicrobial drug code(s) ", vector_and(x$ab[x$ab %in% AMR_env$AB_lookup$ab]), " already exist in the internal `antibiotics` data set." ) - + # remove any extra class/type, such as grouped tbl, or data.table: + x <- as.data.frame(x, stringsAsFactors = FALSE) + # keep only columns available in the antibiotics data set x <- x[, colnames(AMR_env$AB_lookup)[colnames(AMR_env$AB_lookup) %in% colnames(x)], drop = FALSE] x$generalised_name <- generalise_antibiotic_name(x$name) x$generalised_all <- as.list(x$generalised_name) - if ("atc" %in% colnames(x)) { - x$atc <- as.list(x$atc) - } - if ("loinc" %in% colnames(x)) { - x$loinc <- as.list(x$loinc) + for (col in colnames(x)) { + if (is.list(AMR_env$AB_lookup[, col, drop = TRUE])) { + x[, col] <- as.list(x[, col, drop = TRUE]) + } } + AMR_env$custom_ab_codes <- c(AMR_env$custom_ab_codes, x$ab) class(AMR_env$AB_lookup$ab) <- "character" - + new_df <- AMR_env$AB_lookup[0, , drop = FALSE][seq_len(NROW(x)), , drop = FALSE] rownames(new_df) <- NULL list_cols <- vapply(FUN.VALUE = logical(1), new_df, is.list) @@ -134,6 +155,7 @@ add_custom_antimicrobials <- function(x) { new_df[, col] <- x[, col, drop = TRUE] } AMR_env$AB_lookup <- unique(rbind(AMR_env$AB_lookup, new_df)) + AMR_env$ab_previously_coerced <- AMR_env$ab_previously_coerced[which(!AMR_env$ab_previously_coerced$ab %in% new_df$ab), , drop = FALSE] class(AMR_env$AB_lookup$ab) <- c("ab", "character") message_("Added ", nr2char(nrow(x)), " record", ifelse(nrow(x) > 1, "s", ""), " to the internal `antibiotics` data set.") } @@ -141,7 +163,9 @@ add_custom_antimicrobials <- function(x) { #' @rdname add_custom_antimicrobials #' @export clear_custom_antimicrobials <- function() { + n <- nrow(AMR_env$AB_lookup) AMR_env$AB_lookup <- create_AB_lookup() + n2 <- nrow(AMR_env$AB_lookup) AMR_env$custom_ab_codes <- character(0) - message_("Custom antimicrobials cleared.") + message_("Cleared ", nr2char(n - n2), " custom record", ifelse(n - n2 > 1, "s", ""), " from the internal `antibiotics` data set.") } diff --git a/R/add_custom_microorganisms.R b/R/add_custom_microorganisms.R new file mode 100644 index 00000000..bf878676 --- /dev/null +++ b/R/add_custom_microorganisms.R @@ -0,0 +1,212 @@ +# ==================================================================== # +# TITLE # +# AMR: An R Package for Working with Antimicrobial Resistance Data # +# # +# SOURCE # +# https://github.com/msberends/AMR # +# # +# CITE AS # +# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # +# (2022). AMR: An R Package for Working with Antimicrobial Resistance # +# Data. Journal of Statistical Software, 104(3), 1-31. # +# doi:10.18637/jss.v104.i03 # +# # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # +# # +# This R package is free software; you can freely use and distribute # +# it for both personal and commercial purposes under the terms of the # +# GNU General Public License version 2.0 (GNU GPL-2), as published by # +# the Free Software Foundation. # +# We created this package for both routine data analysis and academic # +# research and it was publicly released in the hope that it will be # +# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. # +# # +# Visit our website for the full manual and a complete tutorial about # +# how to conduct AMR data analysis: https://msberends.github.io/AMR/ # +# ==================================================================== # + +#' Add Custom Microorganisms to This Package +#' +#' With [add_custom_microorganisms()] you can add your own custom antimicrobial drug codes to the `AMR` package. +#' @param x a [data.frame] resembling the [microorganisms] data set, at least containing columns "mo", "genus" and "species" +#' @details This function will fill in missing taxonomy for you, if specific taxonomic columns are missing, see *Examples*. +#' +#' **Important:** Due to how \R works, the [add_custom_microorganisms()] function has to be run in every \R session - added microorganisms are not stored between sessions and are thus lost when \R is exited. +#' +#' There are two ways to automate this process: +#' +#' **Method 1:** Save the microorganisms to a local or remote file (can even be the internet). To use this method: +#' +#' 1. Create a data set in the structure of the [microorganisms] data set (containing at the very least columns "ab" and "name") and save it with [saveRDS()] to a location of choice, e.g. `"~/my_custom_mo.rds"`, or any remote location. +#' +#' 2. Set the file location to the `AMR_custom_mo` \R option: `options(AMR_custom_mo = "~/my_custom_mo.rds")`. This can even be a remote file location, such as an https URL. Since options are not saved between \R sessions, it is best to save this option to the `.Rprofile` file so that it will loaded on start-up of \R. To do this, open the `.Rprofile` file using e.g. `utils::file.edit("~/.Rprofile")`, add this text and save the file: +#' +#' ```r +#' # Add custom microorganism codes: +#' options(AMR_custom_mo = "~/my_custom_mo.rds") +#' ``` +#' +#' Upon package load, this file will be loaded and run through the [add_custom_microorganisms()] function. +#' +#' **Method 2:** Save the microorganism directly to your `.Rprofile` file. An important downside is that this requires to load the `AMR` package at every start-up. To use this method: +#' +#' 1. Edit the `.Rprofile` file using e.g. `utils::file.edit("~/.Rprofile")`. +#' +#' 2. Add a text like below and save the file: +#' +#' ```r +#' # Add custom antibiotic drug codes: +#' library(AMR) +#' add_custom_microorganisms( +#' data.frame(mo = "ENT_ASB_CLO", +#' genus = "Enterobacter", +#' species = "asburiae/cloacae") +#' ) +#' ``` +#' +#' Use [clear_custom_microorganisms()] to clear the previously added antimicrobials. +#' @seealso [add_custom_antimicrobials()] to add custom antimicrobials to this package. +#' @rdname add_custom_microorganisms +#' @export +#' @examples +#' \donttest{ +#' +#' # a combination of species is not formal taxonomy, so +#' # this will result in only "Enterobacter asburiae": +#' mo_name("Enterobacter asburiae/cloacae") +#' +#' # now add a custom entry - it will be considered by as.mo() and +#' # all mo_*() functions +#' add_custom_microorganisms( +#' data.frame(mo = "ENT_ASB_CLO", +#' genus = "Enterobacter", +#' species = "asburiae/cloacae" +#' ) +#' ) +#' +#' # "ENT_ASB_CLO" is now a new microorganism: +#' mo_name("Enterobacter asburiae/cloacae") +#' as.mo("ent_asb_clo") +#' mo_name("ent_asb_clo") +#' # all internal algorithms will work as well: +#' mo_name("Ent asburia cloacae") +#' +#' # and even the taxonomy was added based on the genus! +#' mo_family("ent_asb_clo") +#' mo_gramstain("Enterobacter asburiae/cloacae") +#' +#' mo_info("ent_asb_clo") +#' } +add_custom_microorganisms <- function(x) { + meet_criteria(x, allow_class = "data.frame") + required_cols <- c("mo", "genus", "species") + stop_ifnot( + all(required_cols %in% colnames(x)), + paste0("`x` must contain columns ", vector_and(required_cols, sort = FALSE), ".") + ) + stop_if( + any(x$mo %in% AMR_env$MO_lookup$mo), + "Microorganism code(s) ", vector_and(x$mo[x$mo %in% AMR_env$MO_lookup$mo]), " already exist in the internal `microorganisms` data set." + ) + # remove any extra class/type, such as grouped tbl, or data.table: + x <- as.data.frame(x, stringsAsFactors = FALSE) + # rename 'name' to 'fullname' if it's in the data set + if ("name" %in% colnames(x) && !"fullname" %in% colnames(x)) { + colnames(x)[colnames(x) == "name"] <- "fullname" + } + # keep only columns available in the microorganisms data set + x <- x[, colnames(AMR_env$MO_lookup)[colnames(AMR_env$MO_lookup) %in% colnames(x)], drop = FALSE] + + # clean the input ---- + if (!"subspecies" %in% colnames(x)) { + x$subspecies <- NA_character_ + } + x$genus <- trimws2(x$genus) + x$species <- trimws2(x$species) + x$subspecies <- trimws2(x$subspecies) + x$genus[x$genus == ""] <- NA_character_ + x$species[x$species == ""] <- NA_character_ + x$subspecies[x$subspecies == ""] <- NA_character_ + stop_if(any(x$genus[!is.na(x$genus)] %like% " "), + "the 'genus' column must not contain spaces") + stop_if(any(x$species[!is.na(x$species)] %like% " "), + "the 'species' column must not contain spaces") + stop_if(any(x$subspecies[!is.na(x$subspecies)] %like% " "), + "the 'subspecies' column must not contain spaces") + + if ("rank" %in% colnames(x)) { + stop_ifnot(all(x$rank %in% AMR_env$MO_lookup$rank), + "the 'rank' column can only contain these values: ", vector_or(AMR_env$MO_lookup$rank)) + } else { + x$rank <- ifelse(!is.na(x$subspecies), "subspecies", + ifelse(!is.na(x$species), "species", + ifelse(!is.na(x$genus), "genus", + stop("in add_custom_microorganisms(): the 'genus' column cannot be empty", + call. = FALSE)))) + } + if (!"fullname" %in% colnames(x)) { + x$fullname <- paste(x$genus, x$species, x$subspecies) + x$fullname <- gsub(" NA", "", x$fullname) + } + if (!"kingdom" %in% colnames(x)) x$kingdom <- NA_character_ + if (!"phylum" %in% colnames(x)) x$phylum <- NA_character_ + if (!"class" %in% colnames(x)) x$class <- NA_character_ + if (!"order" %in% colnames(x)) x$order <- NA_character_ + if (!"family" %in% colnames(x)) x$family <- NA_character_ + + for (col in colnames(x)) { + if (is.list(AMR_env$MO_lookup[, col, drop = TRUE])) { + x[, col] <- as.list(x[, col, drop = TRUE]) + } + } + + # fill in other columns + x$status <- "accepted" + x$prevalence <- 1 + x$kingdom <- AMR_env$MO_lookup$kingdom[match(x$genus, AMR_env$MO_lookup$genus)] + x$phylum <- AMR_env$MO_lookup$phylum[match(x$genus, AMR_env$MO_lookup$genus)] + x$class <- AMR_env$MO_lookup$class[match(x$genus, AMR_env$MO_lookup$genus)] + x$order <- AMR_env$MO_lookup$order[match(x$genus, AMR_env$MO_lookup$genus)] + x$family <- AMR_env$MO_lookup$family[match(x$genus, AMR_env$MO_lookup$genus)] + + x$kingdom_index <- AMR_env$MO_lookup$kingdom_index[match(x$genus, AMR_env$MO_lookup$genus)] + x$fullname_lower <- tolower(x$fullname) + x$full_first <- substr(x$fullname_lower, 1, 1) + x$species_first <- tolower(substr(x$species, 1, 1)) + x$subspecies_first <- tolower(substr(x$subspecies, 1, 1)) + + # add to pacakge ---- + + AMR_env$custom_mo_codes <- c(AMR_env$custom_mo_codes, x$mo) + class(AMR_env$MO_lookup$mo) <- "character" + + new_df <- AMR_env$MO_lookup[0, , drop = FALSE][seq_len(NROW(x)), , drop = FALSE] + rownames(new_df) <- NULL + list_cols <- vapply(FUN.VALUE = logical(1), new_df, is.list) + for (l in which(list_cols)) { + # prevent binding NULLs in lists, replace with NA + new_df[, l] <- as.list(NA_character_) + } + for (col in colnames(x)) { + # assign new values + new_df[, col] <- x[, col, drop = TRUE] + } + AMR_env$MO_lookup <- unique(rbind(AMR_env$MO_lookup, new_df)) + AMR_env$mo_previously_coerced <- AMR_env$mo_previously_coerced[which(!AMR_env$mo_previously_coerced$mo %in% new_df$mo), , drop = FALSE] + class(AMR_env$MO_lookup$mo) <- c("mo", "character") + message_("Added ", nr2char(nrow(x)), " record", ifelse(nrow(x) > 1, "s", ""), " to the internal `microorganisms` data set.") +} + +#' @rdname add_custom_microorganisms +#' @export +clear_custom_microorganisms <- function() { + n <- nrow(AMR_env$MO_lookup) + AMR_env$MO_lookup <- create_MO_lookup() + n2 <- nrow(AMR_env$MO_lookup) + AMR_env$custom_mo_codes <- character(0) + AMR_env$mo_previously_coerced <- AMR_env$mo_previously_coerced[which(AMR_env$mo_previously_coerced$mo %in% AMR_env$MO_lookup$mo), , drop = FALSE] + AMR_env$mo_uncertainties <- AMR_env$mo_uncertainties[0, , drop = FALSE] + message_("Cleared ", nr2char(n - n2), " custom record", ifelse(n - n2 > 1, "s", ""), " from the internal `microorganisms` data set.") +} diff --git a/R/age.R b/R/age.R index 7176ef4a..50910317 100755 --- a/R/age.R +++ b/R/age.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/amr.R b/R/amr.R index 8bdb459c..5032770d 100644 --- a/R/amr.R +++ b/R/amr.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/atc_online.R b/R/atc_online.R index 84da0415..e2350ac2 100644 --- a/R/atc_online.R +++ b/R/atc_online.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/av.R b/R/av.R index 3ea14646..786a1f39 100755 --- a/R/av.R +++ b/R/av.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/av_from_text.R b/R/av_from_text.R index e567e173..c90a2a98 100644 --- a/R/av_from_text.R +++ b/R/av_from_text.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/av_property.R b/R/av_property.R index b4641fda..39eb8b1e 100644 --- a/R/av_property.R +++ b/R/av_property.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/availability.R b/R/availability.R index 88d80091..671df9f7 100644 --- a/R/availability.R +++ b/R/availability.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/bug_drug_combinations.R b/R/bug_drug_combinations.R index 4745d9f9..a896b921 100644 --- a/R/bug_drug_combinations.R +++ b/R/bug_drug_combinations.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/count.R b/R/count.R index e895feff..1b835809 100755 --- a/R/count.R +++ b/R/count.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/custom_eucast_rules.R b/R/custom_eucast_rules.R index eb2b886f..ce96d115 100644 --- a/R/custom_eucast_rules.R +++ b/R/custom_eucast_rules.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/data.R b/R/data.R index 6cb49a9c..aa293a18 100755 --- a/R/data.R +++ b/R/data.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/deprecated.R b/R/deprecated.R index bf83a853..6a3ddc60 100755 --- a/R/deprecated.R +++ b/R/deprecated.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/disk.R b/R/disk.R index defc28dc..b5a7572b 100644 --- a/R/disk.R +++ b/R/disk.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/episode.R b/R/episode.R index 6ed02cfd..71595744 100644 --- a/R/episode.R +++ b/R/episode.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/eucast_rules.R b/R/eucast_rules.R index f4d7092e..3bba72f5 100755 --- a/R/eucast_rules.R +++ b/R/eucast_rules.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # @@ -204,7 +204,7 @@ eucast_rules <- function(x, expertrules_info <- EUCAST_VERSION_EXPERT_RULES[[which(as.double(names(EUCAST_VERSION_EXPERT_RULES)) == version_expertrules)]] # support old setting (until AMR v1.3.0) - if (missing(rules) && !is.null(getOption("AMR.eucast_rules", default = NULL))) { + if (missing(rules) && !is.null(getOption("AMR.eucast_rules"))) { rules <- getOption("AMR.eucast_rules") } diff --git a/R/first_isolate.R b/R/first_isolate.R index cf43a5d8..882afae1 100755 --- a/R/first_isolate.R +++ b/R/first_isolate.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/g.test.R b/R/g.test.R index 21abd1c8..cde0c6e5 100755 --- a/R/g.test.R +++ b/R/g.test.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/ggplot_pca.R b/R/ggplot_pca.R index f3246c86..a0c1f5a7 100755 --- a/R/ggplot_pca.R +++ b/R/ggplot_pca.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/ggplot_rsi.R b/R/ggplot_rsi.R index 297c2467..14d435e5 100755 --- a/R/ggplot_rsi.R +++ b/R/ggplot_rsi.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/guess_ab_col.R b/R/guess_ab_col.R index ec99d747..dc6dccba 100755 --- a/R/guess_ab_col.R +++ b/R/guess_ab_col.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/italicise_taxonomy.R b/R/italicise_taxonomy.R index 1bba0f31..652bc033 100644 --- a/R/italicise_taxonomy.R +++ b/R/italicise_taxonomy.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/join_microorganisms.R b/R/join_microorganisms.R index 438b0aaf..7194c160 100755 --- a/R/join_microorganisms.R +++ b/R/join_microorganisms.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/key_antimicrobials.R b/R/key_antimicrobials.R index 839949ec..27236092 100755 --- a/R/key_antimicrobials.R +++ b/R/key_antimicrobials.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/kurtosis.R b/R/kurtosis.R index ceb278d3..03996fd0 100755 --- a/R/kurtosis.R +++ b/R/kurtosis.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/like.R b/R/like.R index 933812f0..b7c22881 100755 --- a/R/like.R +++ b/R/like.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/mdro.R b/R/mdro.R index a62bb4e1..ee17a05c 100755 --- a/R/mdro.R +++ b/R/mdro.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/mean_amr_distance.R b/R/mean_amr_distance.R index 9a90b3c2..fe8defc3 100644 --- a/R/mean_amr_distance.R +++ b/R/mean_amr_distance.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/mic.R b/R/mic.R index e282eb8a..d4218b64 100755 --- a/R/mic.R +++ b/R/mic.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/mo.R b/R/mo.R index e144c569..7456fda3 100755 --- a/R/mo.R +++ b/R/mo.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # @@ -200,7 +200,7 @@ as.mo <- function(x, out[x %in% reference_df[[1]]] <- reference_df[[2]][match(x[x %in% reference_df[[1]]], reference_df[[1]])] } # From MO code ---- - out[is.na(out) & x %in% AMR_env$MO_lookup$mo] <- x[is.na(out) & x %in% AMR_env$MO_lookup$mo] + out[is.na(out) & toupper(x) %in% AMR_env$MO_lookup$mo] <- toupper(x[is.na(out) & toupper(x) %in% AMR_env$MO_lookup$mo]) # From full name ---- out[is.na(out) & x_lower %in% AMR_env$MO_lookup$fullname_lower] <- AMR_env$MO_lookup$mo[match(x_lower[is.na(out) & x_lower %in% AMR_env$MO_lookup$fullname_lower], AMR_env$MO_lookup$fullname_lower)] # one exception: "Fungi" matches the kingdom, but instead it should return the 'unknown' code for fungi @@ -210,7 +210,7 @@ as.mo <- function(x, # From SNOMED ---- if (any(is.na(out) & !is.na(x)) && any(is.na(out) & x %in% unlist(microorganisms$snomed), na.rm = TRUE)) { # found this extremely fast gem here: https://stackoverflow.com/a/11002456/4575331 - out[is.na(out) & x %in% unlist(AMR::microorganisms$snomed)] <- AMR::microorganisms$mo[rep(seq_along(AMR::microorganisms$snomed), vapply(FUN.VALUE = double(1), AMR::microorganisms$snomed, length))[match(x[is.na(out) & x %in% unlist(AMR::microorganisms$snomed)], unlist(AMR::microorganisms$snomed))]] + out[is.na(out) & x %in% unlist(AMR_env$MO_lookup$snomed)] <- AMR_env$MO_lookup$mo[rep(seq_along(AMR_env$MO_lookup$snomed), vapply(FUN.VALUE = double(1), AMR_env$MO_lookup$snomed, length))[match(x[is.na(out) & x %in% unlist(AMR_env$MO_lookup$snomed)], unlist(AMR_env$MO_lookup$snomed))]] } # From other familiar output ---- # such as Salmonella groups, colloquial names, etc. @@ -382,20 +382,20 @@ as.mo <- function(x, } # end of loop over all yet unknowns # Keep or replace synonyms ---- - lpsn_matches <- AMR::microorganisms$lpsn_renamed_to[match(out, AMR::microorganisms$mo)] - lpsn_matches[!lpsn_matches %in% AMR::microorganisms$lpsn] <- NA + lpsn_matches <- AMR_env$MO_lookup$lpsn_renamed_to[match(out, AMR_env$MO_lookup$mo)] + lpsn_matches[!lpsn_matches %in% AMR_env$MO_lookup$lpsn] <- NA # GBIF only for non-bacteria, since we use LPSN as primary source for bacteria # (an example is Strep anginosus, renamed according to GBIF, not according to LPSN) - gbif_matches <- AMR::microorganisms$gbif_renamed_to[AMR::microorganisms$kingdom != "Bacteria"][match(out, AMR::microorganisms$mo[AMR::microorganisms$kingdom != "Bacteria"])] - gbif_matches[!gbif_matches %in% AMR::microorganisms$gbif] <- NA + gbif_matches <- AMR_env$MO_lookup$gbif_renamed_to[AMR_env$MO_lookup$kingdom != "Bacteria"][match(out, AMR_env$MO_lookup$mo[AMR_env$MO_lookup$kingdom != "Bacteria"])] + gbif_matches[!gbif_matches %in% AMR_env$MO_lookup$gbif] <- NA AMR_env$mo_renamed <- list( old = out[!is.na(gbif_matches) | !is.na(lpsn_matches)], gbif_matches = gbif_matches[!is.na(gbif_matches) | !is.na(lpsn_matches)], lpsn_matches = lpsn_matches[!is.na(gbif_matches) | !is.na(lpsn_matches)] ) if (isFALSE(keep_synonyms)) { - out[which(!is.na(gbif_matches))] <- AMR::microorganisms$mo[match(gbif_matches[which(!is.na(gbif_matches))], AMR::microorganisms$gbif)] - out[which(!is.na(lpsn_matches))] <- AMR::microorganisms$mo[match(lpsn_matches[which(!is.na(lpsn_matches))], AMR::microorganisms$lpsn)] + out[which(!is.na(gbif_matches))] <- AMR_env$MO_lookup$mo[match(gbif_matches[which(!is.na(gbif_matches))], AMR_env$MO_lookup$gbif)] + out[which(!is.na(lpsn_matches))] <- AMR_env$MO_lookup$mo[match(lpsn_matches[which(!is.na(lpsn_matches))], AMR_env$MO_lookup$lpsn)] if (isTRUE(info) && length(AMR_env$mo_renamed$old) > 0) { print(mo_renamed(), extra_txt = " (use `keep_synonyms = TRUE` to leave uncorrected)") } @@ -416,7 +416,7 @@ as.mo <- function(x, "Staphylococcus", c("caledonicus", "canis", "durrellii", "lloydii", "ratti", "roterodami", "singaporensis", "taiwanensis") ) - if (any(out %in% AMR::microorganisms$mo[match(post_Becker, AMR::microorganisms$fullname)])) { + if (any(out %in% AMR_env$MO_lookup$mo[match(post_Becker, AMR_env$MO_lookup$fullname)])) { if (message_not_thrown_before("as.mo", "becker")) { warning_("in `as.mo()`: Becker ", font_italic("et al."), " (2014, 2019, 2020) does not contain these species named after their publication: ", vector_and(font_italic(gsub("Staphylococcus", "S.", post_Becker, fixed = TRUE), collapse = NULL), quotes = FALSE), @@ -492,10 +492,10 @@ mo_renamed <- function() { x <- AMR_env$mo_renamed x$new <- synonym_mo_to_accepted_mo(x$old) - mo_old <- AMR::microorganisms$fullname[match(x$old, AMR::microorganisms$mo)] - mo_new <- AMR::microorganisms$fullname[match(x$new, AMR::microorganisms$mo)] - ref_old <- AMR::microorganisms$ref[match(x$old, AMR::microorganisms$mo)] - ref_new <- AMR::microorganisms$ref[match(x$new, AMR::microorganisms$mo)] + mo_old <- AMR_env$MO_lookup$fullname[match(x$old, AMR_env$MO_lookup$mo)] + mo_new <- AMR_env$MO_lookup$fullname[match(x$new, AMR_env$MO_lookup$mo)] + ref_old <- AMR_env$MO_lookup$ref[match(x$old, AMR_env$MO_lookup$mo)] + ref_new <- AMR_env$MO_lookup$ref[match(x$new, AMR_env$MO_lookup$mo)] df_renamed <- data.frame( old = mo_old, @@ -553,6 +553,9 @@ pillar_shaft.mo <- function(x, ...) { # markup NA and UNKNOWN out[is.na(x)] <- font_na(" NA") out[x == "UNKNOWN"] <- font_na(" UNKNOWN") + + # markup manual codes + out[x %in% AMR_env$MO_lookup$mo & !x %in% AMR::microorganisms$mo] <- font_blue(out[x %in% AMR_env$MO_lookup$mo & !x %in% AMR::microorganisms$mo], collapse = NULL) df <- tryCatch(get_current_data(arg_name = "x", call = 0), error = function(e) NULL @@ -563,7 +566,7 @@ pillar_shaft.mo <- function(x, ...) { mo_cols <- NULL } - all_mos <- c(AMR::microorganisms$mo, NA) + all_mos <- c(AMR_env$MO_lookup$mo, NA) if (!all(x %in% all_mos) || (!is.null(df) && !all(unlist(df[, which(mo_cols), drop = FALSE]) %in% all_mos))) { # markup old mo codes @@ -665,7 +668,7 @@ print.mo <- function(x, print.shortnames = FALSE, ...) { } x <- as.character(x) names(x) <- x_names - if (!all(x %in% c(AMR::microorganisms$mo, NA))) { + if (!all(x %in% c(AMR_env$MO_lookup$mo, NA))) { warning_( "Some MO codes are from a previous AMR package version. ", "Please update the MO codes with `as.mo()`.", @@ -698,7 +701,7 @@ summary.mo <- function(object, ...) { #' @export #' @noRd as.data.frame.mo <- function(x, ...) { - if (!all(x %in% c(AMR::microorganisms$mo, NA))) { + if (!all(x %in% c(AMR_env$MO_lookup$mo, NA))) { warning_( "The data contains old MO codes (from a previous AMR package version). ", "Please update your MO codes with `as.mo()`." @@ -735,7 +738,7 @@ as.data.frame.mo <- function(x, ...) { y <- NextMethod() attributes(y) <- attributes(i) # must only contain valid MOs - return_after_integrity_check(y, "microorganism code", as.character(AMR::microorganisms$mo)) + return_after_integrity_check(y, "microorganism code", as.character(AMR_env$MO_lookup$mo)) } #' @method [[<- mo #' @export @@ -744,7 +747,7 @@ as.data.frame.mo <- function(x, ...) { y <- NextMethod() attributes(y) <- attributes(i) # must only contain valid MOs - return_after_integrity_check(y, "microorganism code", as.character(AMR::microorganisms$mo)) + return_after_integrity_check(y, "microorganism code", as.character(AMR_env$MO_lookup$mo)) } #' @method c mo #' @export @@ -753,7 +756,7 @@ c.mo <- function(...) { x <- list(...)[[1L]] y <- NextMethod() attributes(y) <- attributes(x) - return_after_integrity_check(y, "microorganism code", as.character(AMR::microorganisms$mo)) + return_after_integrity_check(y, "microorganism code", as.character(AMR_env$MO_lookup$mo)) } #' @method unique mo @@ -859,10 +862,10 @@ print.mo_uncertainties <- function(x, ...) { # Add "Based on {input}" text if it differs from the original input ifelse(x[i, ]$original_input != x[i, ]$input, paste0(strrep(" ", nchar(x[i, ]$original_input) + 6), "Based on input \"", x[i, ]$input, "\""), ""), # Add note if result was coerced to accepted taxonomic name - ifelse(x[i, ]$keep_synonyms == FALSE & x[i, ]$mo %in% AMR::microorganisms$mo[which(AMR::microorganisms$status == "synonym")], + ifelse(x[i, ]$keep_synonyms == FALSE & x[i, ]$mo %in% AMR_env$MO_lookup$mo[which(AMR_env$MO_lookup$status == "synonym")], paste0( strrep(" ", nchar(x[i, ]$original_input) + 6), - font_red(paste0("This old taxonomic name was converted to ", font_italic(AMR::microorganisms$fullname[match(synonym_mo_to_accepted_mo(x[i, ]$mo), AMR::microorganisms$mo)], collapse = NULL), " (", synonym_mo_to_accepted_mo(x[i, ]$mo), ")."), collapse = NULL) + font_red(paste0("This old taxonomic name was converted to ", font_italic(AMR_env$MO_lookup$fullname[match(synonym_mo_to_accepted_mo(x[i, ]$mo), AMR_env$MO_lookup$mo)], collapse = NULL), " (", synonym_mo_to_accepted_mo(x[i, ]$mo), ")."), collapse = NULL) ), "" ), @@ -1030,7 +1033,7 @@ parse_and_convert <- function(x) { replace_old_mo_codes <- function(x, property) { # this function transform old MO codes to current codes, such as: # B_ESCH_COL (AMR v0.5.0) -> B_ESCHR_COLI - ind <- x %like_case% "^[A-Z]_[A-Z_]+$" & !x %in% AMR::microorganisms$mo + ind <- x %like_case% "^[A-Z]_[A-Z_]+$" & !x %in% AMR_env$MO_lookup$mo if (any(ind, na.rm = TRUE)) { # get the ones that match affected <- x[ind] @@ -1144,17 +1147,17 @@ load_mo_uncertainties <- function(metadata) { } synonym_mo_to_accepted_mo <- function(x, fill_in_accepted = FALSE) { - x_gbif <- AMR::microorganisms$gbif_renamed_to[match(x, AMR::microorganisms$mo)] - x_lpsn <- AMR::microorganisms$lpsn_renamed_to[match(x, AMR::microorganisms$mo)] - x_gbif[!x_gbif %in% AMR::microorganisms$gbif] <- NA - x_lpsn[!x_lpsn %in% AMR::microorganisms$lpsn] <- NA + x_gbif <- AMR_env$MO_lookup$gbif_renamed_to[match(x, AMR_env$MO_lookup$mo)] + x_lpsn <- AMR_env$MO_lookup$lpsn_renamed_to[match(x, AMR_env$MO_lookup$mo)] + x_gbif[!x_gbif %in% AMR_env$MO_lookup$gbif] <- NA + x_lpsn[!x_lpsn %in% AMR_env$MO_lookup$lpsn] <- NA out <- ifelse(is.na(x_lpsn), - AMR::microorganisms$mo[match(x_gbif, AMR::microorganisms$gbif)], - AMR::microorganisms$mo[match(x_lpsn, AMR::microorganisms$lpsn)] + AMR_env$MO_lookup$mo[match(x_gbif, AMR_env$MO_lookup$gbif)], + AMR_env$MO_lookup$mo[match(x_lpsn, AMR_env$MO_lookup$lpsn)] ) if (isTRUE(fill_in_accepted)) { - x_accepted <- which(AMR::microorganisms$status[match(x, AMR::microorganisms$mo)] == "accepted") + x_accepted <- which(AMR_env$MO_lookup$status[match(x, AMR_env$MO_lookup$mo)] == "accepted") out[x_accepted] <- x[x_accepted] } out diff --git a/R/mo_matching_score.R b/R/mo_matching_score.R index 544833df..49f85795 100755 --- a/R/mo_matching_score.R +++ b/R/mo_matching_score.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/mo_property.R b/R/mo_property.R index 252535ca..09148905 100755 --- a/R/mo_property.R +++ b/R/mo_property.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # @@ -676,9 +676,9 @@ mo_synonyms <- function(x, language = get_AMR_locale(), keep_synonyms = getOptio metadata <- get_mo_uncertainties() syns <- lapply(x.mo, function(y) { - gbif <- AMR::microorganisms$gbif[match(y, AMR::microorganisms$mo)] - lpsn <- AMR::microorganisms$lpsn[match(y, AMR::microorganisms$mo)] - out <- AMR::microorganisms[which(AMR::microorganisms$lpsn_renamed_to == lpsn | AMR::microorganisms$gbif_renamed_to == gbif), "fullname", drop = TRUE] + gbif <- AMR_env$MO_lookup$gbif[match(y, AMR_env$MO_lookup$mo)] + lpsn <- AMR_env$MO_lookup$lpsn[match(y, AMR_env$MO_lookup$mo)] + out <- AMR_env$MO_lookup[which(AMR_env$MO_lookup$lpsn_renamed_to == lpsn | AMR_env$MO_lookup$gbif_renamed_to == gbif), "fullname", drop = TRUE] if (length(out) == 0) { NULL } else { @@ -760,10 +760,10 @@ mo_url <- function(x, open = FALSE, language = get_AMR_locale(), keep_synonyms = x.mo <- as.mo(x = x, language = language, keep_synonyms = keep_synonyms, ... = ...) metadata <- get_mo_uncertainties() - x.rank <- AMR::microorganisms$rank[match(x.mo, AMR::microorganisms$mo)] - x.name <- AMR::microorganisms$fullname[match(x.mo, AMR::microorganisms$mo)] - x.lpsn <- AMR::microorganisms$lpsn[match(x.mo, AMR::microorganisms$mo)] - x.gbif <- AMR::microorganisms$gbif[match(x.mo, AMR::microorganisms$mo)] + x.rank <- AMR_env$MO_lookup$rank[match(x.mo, AMR_env$MO_lookup$mo)] + x.name <- AMR_env$MO_lookup$fullname[match(x.mo, AMR_env$MO_lookup$mo)] + x.lpsn <- AMR_env$MO_lookup$lpsn[match(x.mo, AMR_env$MO_lookup$mo)] + x.gbif <- AMR_env$MO_lookup$gbif[match(x.mo, AMR_env$MO_lookup$mo)] u <- character(length(x)) u[!is.na(x.gbif)] <- paste0(TAXONOMY_VERSION$GBIF$url, "/species/", x.gbif[!is.na(x.gbif)]) @@ -792,7 +792,7 @@ mo_property <- function(x, property = "fullname", language = get_AMR_locale(), k x <- find_mo_col(fn = "mo_property") } meet_criteria(x, allow_NA = TRUE) - meet_criteria(property, allow_class = "character", has_length = 1, is_in = colnames(AMR::microorganisms)) + meet_criteria(property, allow_class = "character", has_length = 1, is_in = colnames(AMR_env$MO_lookup)) language <- validate_language(language) meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1) @@ -803,7 +803,7 @@ mo_validate <- function(x, property, language, keep_synonyms = keep_synonyms, .. # try to catch an error when inputting an invalid argument # so the 'call.' can be set to FALSE - tryCatch(x[1L] %in% unlist(AMR::microorganisms[1, property, drop = TRUE]), + tryCatch(x[1L] %in% unlist(AMR_env$MO_lookup[1, property, drop = TRUE]), error = function(e) stop(e$message, call. = FALSE) ) @@ -819,7 +819,7 @@ mo_validate <- function(x, property, language, keep_synonyms = keep_synonyms, .. has_Becker_or_Lancefield <- Becker %in% c(TRUE, "all") || Lancefield %in% c(TRUE, "all") # get microorganisms data set, but remove synonyms if keep_synonyms is FALSE - mo_data_check <- AMR::microorganisms[which(AMR::microorganisms$status %in% if (isTRUE(keep_synonyms)) c("synonym", "accepted") else "accepted"), , drop = FALSE] + mo_data_check <- AMR_env$MO_lookup[which(AMR_env$MO_lookup$status %in% if (isTRUE(keep_synonyms)) c("synonym", "accepted") else "accepted"), , drop = FALSE] if (all(x %in% c(mo_data_check$mo, NA)) && !has_Becker_or_Lancefield) { # do nothing, just don't run the other if-else's @@ -833,7 +833,7 @@ mo_validate <- function(x, property, language, keep_synonyms = keep_synonyms, .. } # get property reeaaally fast using match() - x <- AMR::microorganisms[[property]][match(x, AMR::microorganisms$mo)] + x <- AMR_env$MO_lookup[[property]][match(x, AMR_env$MO_lookup$mo)] if (property == "mo") { return(set_clean_class(x, new_class = c("mo", "character"))) diff --git a/R/mo_source.R b/R/mo_source.R index 4ea9ff1e..1f449890 100644 --- a/R/mo_source.R +++ b/R/mo_source.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # @@ -149,7 +149,7 @@ set_mo_source <- function(path, destination = getOption("AMR_mo_source", "~/mo_s df <- NULL if (path %like% "[.]rds$") { - df <- readRDS(path) + df <- readRDS2(path) } else if (path %like% "[.]xlsx?$") { # is Excel file (old or new) stop_ifnot_installed("readxl") @@ -248,7 +248,7 @@ get_mo_source <- function(destination = getOption("AMR_mo_source", "~/mo_source. return(NULL) } if (is.null(AMR_env$mo_source)) { - AMR_env$mo_source <- readRDS(path.expand(destination)) + AMR_env$mo_source <- readRDS2(path.expand(destination)) } old_time <- attributes(AMR_env$mo_source)$mo_source_timestamp diff --git a/R/pca.R b/R/pca.R index de891b98..d4501c5b 100755 --- a/R/pca.R +++ b/R/pca.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/plot.R b/R/plot.R index f81f533f..1a4d2402 100644 --- a/R/plot.R +++ b/R/plot.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/proportion.R b/R/proportion.R index bb67ff65..0af65a3c 100755 --- a/R/proportion.R +++ b/R/proportion.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/random.R b/R/random.R index 19062bdd..da176721 100644 --- a/R/random.R +++ b/R/random.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/resistance_predict.R b/R/resistance_predict.R index e66756d8..71be3380 100755 --- a/R/resistance_predict.R +++ b/R/resistance_predict.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/rsi.R b/R/rsi.R index 4075043c..6f575b1a 100755 --- a/R/rsi.R +++ b/R/rsi.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/rsi_calc.R b/R/rsi_calc.R index 50c6a03a..5efbc462 100755 --- a/R/rsi_calc.R +++ b/R/rsi_calc.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/rsi_df.R b/R/rsi_df.R index 64ace576..1ea0b608 100644 --- a/R/rsi_df.R +++ b/R/rsi_df.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/skewness.R b/R/skewness.R index 847f57e0..44b9b770 100755 --- a/R/skewness.R +++ b/R/skewness.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/translate.R b/R/translate.R index d1c11d36..9addac4a 100755 --- a/R/translate.R +++ b/R/translate.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # @@ -91,7 +91,7 @@ #' ab_name("amox/clav") get_AMR_locale <- function() { # a message for this will be thrown in translate_into_language() if outcome is non-English - if (!is.null(getOption("AMR_locale", default = NULL))) { + if (!is.null(getOption("AMR_locale"))) { return(validate_language(getOption("AMR_locale"), extra_txt = "set with `options(AMR_locale = ...)`")) } lang <- "" diff --git a/R/vctrs.R b/R/vctrs.R index 6c8236a9..eba037fe 100644 --- a/R/vctrs.R +++ b/R/vctrs.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # @@ -95,7 +95,7 @@ vec_cast.character.mo <- function(x, to, ...) { as.character(x) } vec_cast.mo.character <- function(x, to, ...) { - return_after_integrity_check(x, "microorganism code", as.character(AMR::microorganisms$mo)) + return_after_integrity_check(x, "microorganism code", as.character(AMR_env$MO_lookup$mo)) } # S3: disk diff --git a/R/whocc.R b/R/whocc.R index 2ce47d17..bfbf3260 100755 --- a/R/whocc.R +++ b/R/whocc.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/R/zzz.R b/R/zzz.R index 31374934..91fa51ad 100755 --- a/R/zzz.R +++ b/R/zzz.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # @@ -72,6 +72,7 @@ AMR_env$rsi_interpretation_history <- data.frame( stringsAsFactors = FALSE ) AMR_env$custom_ab_codes <- character(0) +AMR_env$custom_mo_codes <- character(0) AMR_env$is_dark_theme <- NULL # determine info icon for messages @@ -171,12 +172,11 @@ if (utf8_supported && !is_latex) { # if mo source exists, fire it up (see mo_source()) if (tryCatch(file.exists(getOption("AMR_mo_source", "~/mo_source.rds")), error = function(e) FALSE)) { - invisible(get_mo_source()) + try(invisible(get_mo_source()), silent = TRUE) } - # be sure to print tibbles as tibbles if (pkg_is_available("tibble", also_load = FALSE)) { - loadNamespace("tibble") + try(loadNamespace("tibble"), silent = TRUE) } # reference data - they have additional columns compared to `antibiotics` and `microorganisms` to improve speed @@ -184,6 +184,25 @@ if (utf8_supported && !is_latex) { AMR_env$AB_lookup <- create_AB_lookup() AMR_env$AV_lookup <- create_AV_lookup() AMR_env$MO_lookup <- create_MO_lookup() + + # if custom ab option is available, load it + if (!is.null(getOption("AMR_custom_ab")) && file.exists(getOption("AMR_custom_ab", default = ""))) { + packageStartupMessage("Adding custom antimicrobials from '", getOption("AMR_custom_ab"), "'...", appendLF = FALSE) + x <- readRDS2(getOption("AMR_custom_ab")) + tryCatch({ + suppressWarnings(suppressMessages(add_custom_antimicrobials(x))) + packageStartupMessage("OK.") + }, error = function(e) packageStartupMessage("Failed: ", e$message)) + } + # if custom mo option is available, load it + if (!is.null(getOption("AMR_custom_mo")) && file.exists(getOption("AMR_custom_mo", default = ""))) { + packageStartupMessage("Adding custom microorganisms from '", getOption("AMR_custom_mo"), "'...", appendLF = FALSE) + x <- readRDS2(getOption("AMR_custom_mo")) + tryCatch({ + suppressWarnings(suppressMessages(add_custom_microorganisms(x))) + packageStartupMessage("OK.") + }, error = function(e) packageStartupMessage("Failed: ", e$message)) + } } # Helper functions -------------------------------------------------------- diff --git a/_pkgdown.yml b/_pkgdown.yml index 04b6b3a9..b48afc00 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/codecov.yml b/codecov.yml index 8c34898f..4651d9a1 100644 --- a/codecov.yml +++ b/codecov.yml @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/data-raw/_install_deps.R b/data-raw/_install_deps.R index 89784068..a072140d 100644 --- a/data-raw/_install_deps.R +++ b/data-raw/_install_deps.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/data-raw/_language_update.R b/data-raw/_language_update.R index ca5df9ea..6e55afe8 100644 --- a/data-raw/_language_update.R +++ b/data-raw/_language_update.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/data-raw/_pre_commit_hook.R b/data-raw/_pre_commit_hook.R index ce3948dd..be217489 100644 --- a/data-raw/_pre_commit_hook.R +++ b/data-raw/_pre_commit_hook.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/data-raw/loinc.R b/data-raw/loinc.R index 28d4b095..59681712 100644 --- a/data-raw/loinc.R +++ b/data-raw/loinc.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/data-raw/poorman_prepend.R b/data-raw/poorman_prepend.R index 74fc453c..6b55d897 100644 --- a/data-raw/poorman_prepend.R +++ b/data-raw/poorman_prepend.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/data-raw/read_EUCAST.R b/data-raw/read_EUCAST.R index 1ec66726..9495b4c9 100644 --- a/data-raw/read_EUCAST.R +++ b/data-raw/read_EUCAST.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/data-raw/reproduction_of_antibiotics.R b/data-raw/reproduction_of_antibiotics.R index d7ac718d..7a8b980c 100644 --- a/data-raw/reproduction_of_antibiotics.R +++ b/data-raw/reproduction_of_antibiotics.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/data-raw/reproduction_of_antivirals.R b/data-raw/reproduction_of_antivirals.R index 6659e431..49591034 100644 --- a/data-raw/reproduction_of_antivirals.R +++ b/data-raw/reproduction_of_antivirals.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/data-raw/reproduction_of_dosage.R b/data-raw/reproduction_of_dosage.R index ba019451..456e05cc 100644 --- a/data-raw/reproduction_of_dosage.R +++ b/data-raw/reproduction_of_dosage.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/data-raw/reproduction_of_example_isolates_unclean.R b/data-raw/reproduction_of_example_isolates_unclean.R index 98bd8314..5be7426a 100644 --- a/data-raw/reproduction_of_example_isolates_unclean.R +++ b/data-raw/reproduction_of_example_isolates_unclean.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/data-raw/reproduction_of_intrinsic_resistant.R b/data-raw/reproduction_of_intrinsic_resistant.R index a5d80aef..c1defc53 100644 --- a/data-raw/reproduction_of_intrinsic_resistant.R +++ b/data-raw/reproduction_of_intrinsic_resistant.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/data-raw/reproduction_of_microorganisms.R b/data-raw/reproduction_of_microorganisms.R index 12e3ce40..c5d36dac 100644 --- a/data-raw/reproduction_of_microorganisms.R +++ b/data-raw/reproduction_of_microorganisms.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/data-raw/reproduction_of_rsi_translation.R b/data-raw/reproduction_of_rsi_translation.R index 7af133b7..6ed1db0b 100644 --- a/data-raw/reproduction_of_rsi_translation.R +++ b/data-raw/reproduction_of_rsi_translation.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/data-raw/salmonellae.R b/data-raw/salmonellae.R index 4f3cc64e..195fce89 100644 --- a/data-raw/salmonellae.R +++ b/data-raw/salmonellae.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-_deprecated.R b/inst/tinytest/test-_deprecated.R index eb5a7875..a41cfa3c 100644 --- a/inst/tinytest/test-_deprecated.R +++ b/inst/tinytest/test-_deprecated.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-_misc.R b/inst/tinytest/test-_misc.R index 565dcc15..6430fb86 100755 --- a/inst/tinytest/test-_misc.R +++ b/inst/tinytest/test-_misc.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-ab.R b/inst/tinytest/test-ab.R index 84a6614d..df63055f 100755 --- a/inst/tinytest/test-ab.R +++ b/inst/tinytest/test-ab.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-ab_from_text.R b/inst/tinytest/test-ab_from_text.R index 446c9933..ec322ae4 100644 --- a/inst/tinytest/test-ab_from_text.R +++ b/inst/tinytest/test-ab_from_text.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-ab_property.R b/inst/tinytest/test-ab_property.R index 89cd0afb..3fb738a7 100644 --- a/inst/tinytest/test-ab_property.R +++ b/inst/tinytest/test-ab_property.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-ab_selectors.R b/inst/tinytest/test-ab_selectors.R index ce36b209..77c85f2b 100644 --- a/inst/tinytest/test-ab_selectors.R +++ b/inst/tinytest/test-ab_selectors.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-add_custom_antimicrobials.R b/inst/tinytest/test-add_custom_antimicrobials.R index c692d5e2..02caf3cc 100644 --- a/inst/tinytest/test-add_custom_antimicrobials.R +++ b/inst/tinytest/test-add_custom_antimicrobials.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-add_custom_microorganisms.R b/inst/tinytest/test-add_custom_microorganisms.R new file mode 100644 index 00000000..d8707906 --- /dev/null +++ b/inst/tinytest/test-add_custom_microorganisms.R @@ -0,0 +1,43 @@ +# ==================================================================== # +# TITLE # +# AMR: An R Package for Working with Antimicrobial Resistance Data # +# # +# SOURCE # +# https://github.com/msberends/AMR # +# # +# CITE AS # +# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # +# (2022). AMR: An R Package for Working with Antimicrobial Resistance # +# Data. Journal of Statistical Software, 104(3), 1-31. # +# doi:10.18637/jss.v104.i03 # +# # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # +# # +# This R package is free software; you can freely use and distribute # +# it for both personal and commercial purposes under the terms of the # +# GNU General Public License version 2.0 (GNU GPL-2), as published by # +# the Free Software Foundation. # +# We created this package for both routine data analysis and academic # +# research and it was publicly released in the hope that it will be # +# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. # +# # +# Visit our website for the full manual and a complete tutorial about # +# how to conduct AMR data analysis: https://msberends.github.io/AMR/ # +# ==================================================================== # + +expect_identical(as.mo("Enterobacter asburiae/cloacae"), + as.mo("Enterobacter asburiae")) + +suppressMessages( + add_custom_microorganisms( + data.frame(mo = "ENT_ASB_CLO", + genus = "Enterobacter", + species = "asburiae/cloacae") + ) +) + +expect_identical(as.character(as.mo("ENT_ASB_CLO")), "ENT_ASB_CLO") +expect_identical(mo_name("ENT_ASB_CLO"), "Enterobacter asburiae/cloacae") +expect_identical(mo_gramstain("ENT_ASB_CLO", language = NULL), "Gram-negative") diff --git a/inst/tinytest/test-age.R b/inst/tinytest/test-age.R index 0020d91e..81803c66 100644 --- a/inst/tinytest/test-age.R +++ b/inst/tinytest/test-age.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-atc_online.R b/inst/tinytest/test-atc_online.R index d5bf7747..3dff8631 100644 --- a/inst/tinytest/test-atc_online.R +++ b/inst/tinytest/test-atc_online.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-av.R b/inst/tinytest/test-av.R index 3daa1e1d..c729bb91 100755 --- a/inst/tinytest/test-av.R +++ b/inst/tinytest/test-av.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-av_from_text.R b/inst/tinytest/test-av_from_text.R index dfa144a2..5e720732 100644 --- a/inst/tinytest/test-av_from_text.R +++ b/inst/tinytest/test-av_from_text.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-av_property.R b/inst/tinytest/test-av_property.R index 1599343e..1885edc4 100644 --- a/inst/tinytest/test-av_property.R +++ b/inst/tinytest/test-av_property.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-availability.R b/inst/tinytest/test-availability.R index bdf5c356..83928299 100644 --- a/inst/tinytest/test-availability.R +++ b/inst/tinytest/test-availability.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-bug_drug_combinations.R b/inst/tinytest/test-bug_drug_combinations.R index cd317d0a..4ec5eec0 100644 --- a/inst/tinytest/test-bug_drug_combinations.R +++ b/inst/tinytest/test-bug_drug_combinations.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-count.R b/inst/tinytest/test-count.R index 9f80f129..09d54a18 100644 --- a/inst/tinytest/test-count.R +++ b/inst/tinytest/test-count.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-data.R b/inst/tinytest/test-data.R index 86d0542d..b012f5fe 100644 --- a/inst/tinytest/test-data.R +++ b/inst/tinytest/test-data.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-disk.R b/inst/tinytest/test-disk.R index 7d6d2f4a..0de4cd05 100755 --- a/inst/tinytest/test-disk.R +++ b/inst/tinytest/test-disk.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-episode.R b/inst/tinytest/test-episode.R index 2da879aa..ee420dd2 100644 --- a/inst/tinytest/test-episode.R +++ b/inst/tinytest/test-episode.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-eucast_rules.R b/inst/tinytest/test-eucast_rules.R index c7a7d18f..ad08c12c 100755 --- a/inst/tinytest/test-eucast_rules.R +++ b/inst/tinytest/test-eucast_rules.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-first_isolate.R b/inst/tinytest/test-first_isolate.R index f03050bf..c8ca6858 100755 --- a/inst/tinytest/test-first_isolate.R +++ b/inst/tinytest/test-first_isolate.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-g.test.R b/inst/tinytest/test-g.test.R index 0d80863e..d1d7d247 100644 --- a/inst/tinytest/test-g.test.R +++ b/inst/tinytest/test-g.test.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-get_locale.R b/inst/tinytest/test-get_locale.R index 8fca84ec..228d02b2 100644 --- a/inst/tinytest/test-get_locale.R +++ b/inst/tinytest/test-get_locale.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-ggplot_rsi.R b/inst/tinytest/test-ggplot_rsi.R index 85ab1156..24af561c 100644 --- a/inst/tinytest/test-ggplot_rsi.R +++ b/inst/tinytest/test-ggplot_rsi.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-guess_ab_col.R b/inst/tinytest/test-guess_ab_col.R index b14ca78a..c3a537dd 100644 --- a/inst/tinytest/test-guess_ab_col.R +++ b/inst/tinytest/test-guess_ab_col.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-italicise_taxonomy.R b/inst/tinytest/test-italicise_taxonomy.R index a88ef33f..ff6321e8 100644 --- a/inst/tinytest/test-italicise_taxonomy.R +++ b/inst/tinytest/test-italicise_taxonomy.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-join_microorganisms.R b/inst/tinytest/test-join_microorganisms.R index 4937ceca..bb07674b 100755 --- a/inst/tinytest/test-join_microorganisms.R +++ b/inst/tinytest/test-join_microorganisms.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-key_antimicrobials.R b/inst/tinytest/test-key_antimicrobials.R index 3b5f216b..94f8d99b 100644 --- a/inst/tinytest/test-key_antimicrobials.R +++ b/inst/tinytest/test-key_antimicrobials.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-kurtosis.R b/inst/tinytest/test-kurtosis.R index 1019d489..65da50c5 100644 --- a/inst/tinytest/test-kurtosis.R +++ b/inst/tinytest/test-kurtosis.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-like.R b/inst/tinytest/test-like.R index 3deb63f0..2b345551 100644 --- a/inst/tinytest/test-like.R +++ b/inst/tinytest/test-like.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-mdro.R b/inst/tinytest/test-mdro.R index a4389d1c..87532d9d 100755 --- a/inst/tinytest/test-mdro.R +++ b/inst/tinytest/test-mdro.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-mean_amr_distance.R b/inst/tinytest/test-mean_amr_distance.R index b7ad09ea..cdbf91fd 100644 --- a/inst/tinytest/test-mean_amr_distance.R +++ b/inst/tinytest/test-mean_amr_distance.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-mic.R b/inst/tinytest/test-mic.R index ad5f6158..7d9a9336 100755 --- a/inst/tinytest/test-mic.R +++ b/inst/tinytest/test-mic.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-mo.R b/inst/tinytest/test-mo.R index 845bc5af..cf1a1fe2 100644 --- a/inst/tinytest/test-mo.R +++ b/inst/tinytest/test-mo.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-mo_property.R b/inst/tinytest/test-mo_property.R index fda8f3f9..5fc27749 100644 --- a/inst/tinytest/test-mo_property.R +++ b/inst/tinytest/test-mo_property.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-pca.R b/inst/tinytest/test-pca.R index 38318395..0286debe 100644 --- a/inst/tinytest/test-pca.R +++ b/inst/tinytest/test-pca.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-proportion.R b/inst/tinytest/test-proportion.R index f65bca11..81162740 100755 --- a/inst/tinytest/test-proportion.R +++ b/inst/tinytest/test-proportion.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-random.R b/inst/tinytest/test-random.R index cd0b62c9..7e7251c0 100644 --- a/inst/tinytest/test-random.R +++ b/inst/tinytest/test-random.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-resistance_predict.R b/inst/tinytest/test-resistance_predict.R index 478581c9..5b66f998 100644 --- a/inst/tinytest/test-resistance_predict.R +++ b/inst/tinytest/test-resistance_predict.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-rsi.R b/inst/tinytest/test-rsi.R index 0a8c3f8e..5cbe2423 100644 --- a/inst/tinytest/test-rsi.R +++ b/inst/tinytest/test-rsi.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-skewness.R b/inst/tinytest/test-skewness.R index 0ae0ea0f..e5b5f1ce 100644 --- a/inst/tinytest/test-skewness.R +++ b/inst/tinytest/test-skewness.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-vctrs.R b/inst/tinytest/test-vctrs.R index d9d88051..046d582e 100755 --- a/inst/tinytest/test-vctrs.R +++ b/inst/tinytest/test-vctrs.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/inst/tinytest/test-zzz.R b/inst/tinytest/test-zzz.R index 7dcd4c00..1d850428 100644 --- a/inst/tinytest/test-zzz.R +++ b/inst/tinytest/test-zzz.R @@ -11,9 +11,9 @@ # Data. Journal of Statistical Software, 104(3), 1-31. # # doi:10.18637/jss.v104.i03 # # # -# Developed at the University of Groningen, the Netherlands, in # -# collaboration with non-profit organisations Certe Medical # -# Diagnostics & Advice, and University Medical Center Groningen. # +# Developed at the University of Groningen and the University Medical # +# Center Groningen in The Netherlands, in collaboration with many # +# colleagues from around the world, see our website. # # # # This R package is free software; you can freely use and distribute # # it for both personal and commercial purposes under the terms of the # diff --git a/man/add_custom_antimicrobials.Rd b/man/add_custom_antimicrobials.Rd index af0ccd56..63b970e1 100644 --- a/man/add_custom_antimicrobials.Rd +++ b/man/add_custom_antimicrobials.Rd @@ -16,20 +16,37 @@ clear_custom_antimicrobials() With \code{\link[=add_custom_antimicrobials]{add_custom_antimicrobials()}} you can add your own custom antimicrobial drug codes to the \code{AMR} package. } \details{ -Due to how \R works, the \code{\link[=add_custom_antimicrobials]{add_custom_antimicrobials()}} function has to be run in every \R session - added antimicrobials are not stored between sessions and are thus lost when \R is exited. It is possible to save the antimicrobial additions to your \code{.Rprofile} file to circumvent this, although this requires to load the \code{AMR} package at every start-up: +\strong{Important:} Due to how \R works, the \code{\link[=add_custom_antimicrobials]{add_custom_antimicrobials()}} function has to be run in every \R session - added antimicrobials are not stored between sessions and are thus lost when \R is exited. -\if{html}{\out{