diff --git a/DESCRIPTION b/DESCRIPTION index 961eb179..ca8262be 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 2.0.0.9041 -Date: 2023-07-12 +Version: 2.0.0.9044 +Date: 2023-07-14 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/NEWS.md b/NEWS.md index f246fad2..6186fac8 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 2.0.0.9041 +# AMR 2.0.0.9044 ## New * Clinical breakpoints and intrinsic resistance of EUCAST 2023 and CLSI 2023 have been added for `as.sir()`. EUCAST 2023 (v13.0) is now the new default guideline for all MIC and disks diffusion interpretations diff --git a/R/aa_helper_functions.R b/R/aa_helper_functions.R index 8fea58d6..5665f969 100755 --- a/R/aa_helper_functions.R +++ b/R/aa_helper_functions.R @@ -502,19 +502,24 @@ word_wrap <- function(..., # format backticks if (pkg_is_available("cli") && - tryCatch(getExportedValue("isAvailable", ns = asNamespace("rstudioapi"))(), error = function(e) return(FALSE))) { + tryCatch(isTRUE(getExportedValue("ansi_has_hyperlink_support", ns = asNamespace("cli"))()), error = function(e) FALSE) && + tryCatch(getExportedValue("isAvailable", ns = asNamespace("rstudioapi"))(), error = function(e) return(FALSE)) && + tryCatch(getExportedValue("versionInfo", ns = asNamespace("rstudioapi"))()$version > "2023.6.0.0", error = function(e) return(FALSE))) { + # we are in a recent version of RStudio, so do something nice: add links to our help pages in the console. parts <- strsplit(msg, "`", fixed = TRUE)[[1]] cmds <- parts %in% paste0(ls(envir = asNamespace("AMR")), "()") # functions with a dot are not allowed: https://github.com/rstudio/rstudio/issues/11273#issuecomment-1156193252 + # lead them to the help page of our package parts[cmds & parts %like% "[.]"] <- font_url(url = paste0("ide:help:AMR::", gsub("()", "", parts[cmds & parts %like% "[.]"], fixed = TRUE)), txt = parts[cmds & parts %like% "[.]"]) + # otherwise, give a 'click to run' popup parts[cmds & parts %unlike% "[.]"] <- font_url(url = paste0("ide:run:AMR::", parts[cmds & parts %unlike% "[.]"]), txt = parts[cmds & parts %unlike% "[.]"]) msg <- paste0(parts, collapse = "`") } msg <- gsub("`(.+?)`", font_grey_bg("\\1"), msg) - # clean introduced whitespace between fullstops + # clean introduced whitespace in between fullstops msg <- gsub("[.] +[.]", "..", msg) # remove extra space that was introduced (e.g. "Smith et al. , 2022") msg <- gsub(". ,", ".,", msg, fixed = TRUE) diff --git a/R/sysdata.rda b/R/sysdata.rda index f74fb9ad..974ea73b 100755 Binary files a/R/sysdata.rda and b/R/sysdata.rda differ diff --git a/inst/tinytest/test-zzz.R b/inst/tinytest/test-zzz.R index 5c85b18d..0bc25822 100644 --- a/inst/tinytest/test-zzz.R +++ b/inst/tinytest/test-zzz.R @@ -61,6 +61,10 @@ call_functions <- c( "freq.default" = "cleaner", # cli "symbol" = "cli", + "ansi_has_hyperlink_support" = "cli", + # rstudioapi (RStudio) + "isAvailable" = "rstudioapi", + "versionInfo" = "rstudioapi", # readxl "read_excel" = "readxl", # ggplot2 @@ -120,18 +124,19 @@ for (i in seq_len(length(import_functions))) { also_load = FALSE, min_version = if (pkg == "dplyr") "1.0.0" else NULL )) { - tst <- !is.null(AMR:::import_fn(name = fn, pkg = pkg, error_on_fail = FALSE)) - expect_true(tst, - info = ifelse(tst, - "All external function references exist.", - paste0("Function ", pkg, "::", fn, "() does not exist anymore") - ) + expect_true(!is.null(AMR:::import_fn(name = fn, pkg = pkg, error_on_fail = FALSE)), + info = paste0("does not exist (anymore): function `", pkg, "::", fn, "()`") ) + } else { + warning("Package '", pkg, "' does not exist anymore") } } if (AMR:::pkg_is_available("cli")) { expect_true(!is.null(cli::symbol$info)) - expect_true(!is.null(cli::symbol$bullet)) +} +if (AMR:::pkg_is_available("cli")) { +} +if (AMR:::pkg_is_available("cli")) { expect_true(!is.null(cli::symbol$ellipsis)) } diff --git a/man/AMR.Rd b/man/AMR.Rd index 48d89359..0f4b2845 100644 --- a/man/AMR.Rd +++ b/man/AMR.Rd @@ -32,7 +32,7 @@ The \code{AMR} package is a \href{https://msberends.github.io/AMR/#copyright}{fr This work was published in the Journal of Statistical Software (Volume 104(3); \doi{jss.v104.i03}) and formed the basis of two PhD theses (\doi{10.33612/diss.177417131} and \doi{10.33612/diss.192486375}). -After installing this package, R knows \href{https://msberends.github.io/AMR/reference/microorganisms.html}{\strong{~52 000 microorganisms}} (updated december 2022) and all \href{https://msberends.github.io/AMR/reference/antibiotics.html}{\strong{~600 antibiotic, antimycotic and antiviral drugs}} by name and code (including ATC, EARS-Net, ASIARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid SIR and MIC values. The integral clinical breakpoint guidelines from CLSI and EUCAST are included, even with epidemiological cut-off (ECOFF) values. It supports and can read any data format, including WHONET data. This package works on Windows, macOS and Linux with all versions of R since R-3.0 (April 2013). \strong{It was designed to work in any setting, including those with very limited resources}. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the \href{https://www.rug.nl}{University of Groningen}, in collaboration with non-profit organisations \href{https://www.certe.nl}{Certe Medical Diagnostics and Advice Foundation} and \href{https://www.umcg.nl}{University Medical Center Groningen}. +After installing this package, R knows \href{https://msberends.github.io/AMR/reference/microorganisms.html}{\strong{~52 000 microorganisms}} (updated December 2022) and all \href{https://msberends.github.io/AMR/reference/antibiotics.html}{\strong{~600 antibiotic, antimycotic and antiviral drugs}} by name and code (including ATC, EARS-Net, ASIARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid SIR and MIC values. The integral clinical breakpoint guidelines from CLSI and EUCAST are included, even with epidemiological cut-off (ECOFF) values. It supports and can read any data format, including WHONET data. This package works on Windows, macOS and Linux with all versions of R since R-3.0 (April 2013). \strong{It was designed to work in any setting, including those with very limited resources}. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the \href{https://www.rug.nl}{University of Groningen}, in collaboration with non-profit organisations \href{https://www.certe.nl}{Certe Medical Diagnostics and Advice Foundation} and \href{https://www.umcg.nl}{University Medical Center Groningen}. The \code{AMR} package is available in English, Chinese, Czech, Danish, Dutch, Finnish, French, German, Greek, Italian, Japanese, Norwegian, Polish, Portuguese, Romanian, Russian, Spanish, Swedish, Turkish, and Ukrainian. Antimicrobial drug (group) names and colloquial microorganism names are provided in these languages. } diff --git a/tests/tinytest.R b/tests/tinytest.R index 7294baa2..cd47f52f 100644 --- a/tests/tinytest.R +++ b/tests/tinytest.R @@ -67,8 +67,8 @@ if (tryCatch(isTRUE(AMR:::import_fn("isJob", "rstudioapi")()), error = function( # start the unit tests suppressMessages( - out <- test_package("AMR", - testdir = ifelse(dir.exists("inst/tinytest"), + out <- run_test_dir( + ifelse(dir.exists("inst/tinytest"), "inst/tinytest", "tinytest" ),