From c44ddf272fc6a9172796b1c43f536207efdd7bf3 Mon Sep 17 00:00:00 2001 From: "Matthijs S. Berends" Date: Sun, 28 Aug 2022 19:34:04 +0200 Subject: [PATCH] fix for R <= 3.3 --- .github/workflows/check.yaml | 3 +++ DESCRIPTION | 2 +- NEWS.md | 2 +- R/aa_helper_functions.R | 2 +- inst/tinytest/test-data.R | 12 +++++++----- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index bec95ebd..f49382e4 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -135,6 +135,7 @@ jobs: R_RUN_TINYTEST: true run: | cd .. + ls -lh R CMD build AMR R CMD check --no-manual --run-donttest --run-dontrun AMR_*.tar.gz shell: bash @@ -142,6 +143,8 @@ jobs: - name: Show unit tests output if: always() run: | + ls -lh + cd AMR find . -name 'tinytest.Rout*' -exec cat '{}' \; || true shell: bash diff --git a/DESCRIPTION b/DESCRIPTION index 527ce06f..48fbf4ca 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: AMR -Version: 1.8.1.9039 +Version: 1.8.1.9040 Date: 2022-08-28 Title: Antimicrobial Resistance Data Analysis Description: Functions to simplify and standardise antimicrobial resistance (AMR) diff --git a/NEWS.md b/NEWS.md index 55ee8c17..d5bd600f 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 1.8.1.9039 +# AMR 1.8.1.9040 ### New * EUCAST 2022 and CLSI 2022 guidelines have been added for `as.rsi()`. EUCAST 2022 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 94c1fa46..a86f195b 100755 --- a/R/aa_helper_functions.R +++ b/R/aa_helper_functions.R @@ -651,7 +651,7 @@ dataset_UTF8_to_ASCII <- function(df) { df[, i] <- col } } - tibble::as_tibble(df) + import_fn("as_tibble", "tibble")(df) } # for eucast_rules() and mdro(), creates markdown output with URLs and names diff --git a/inst/tinytest/test-data.R b/inst/tinytest/test-data.R index 22e2b003..300d5d1c 100644 --- a/inst/tinytest/test-data.R +++ b/inst/tinytest/test-data.R @@ -53,11 +53,13 @@ expect_false(any(is.na(as.disk(rsi_translation[which(rsi_translation$method == " # antibiotic names must always be coercible to their original AB code expect_identical(as.ab(antibiotics$name), antibiotics$ab) -# there should be no diacritics (i.e. non ASCII) characters in the datasets (CRAN policy) -datasets <- data(package = "AMR", envir = asNamespace("AMR"))$results[, "Item", drop = TRUE] -for (i in seq_len(length(datasets))) { - dataset <- get(datasets[i], envir = asNamespace("AMR")) - expect_identical(AMR:::dataset_UTF8_to_ASCII(dataset), dataset, info = datasets[i]) +if (AMR:::pkg_is_available("tibble", also_load = FALSE)) { + # there should be no diacritics (i.e. non ASCII) characters in the datasets (CRAN policy) + datasets <- data(package = "AMR", envir = asNamespace("AMR"))$results[, "Item", drop = TRUE] + for (i in seq_len(length(datasets))) { + dataset <- get(datasets[i], envir = asNamespace("AMR")) + expect_identical(AMR:::dataset_UTF8_to_ASCII(dataset), dataset, info = datasets[i]) + } } df <- AMR:::MO_lookup