diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index d6802c8d..94a609b1 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -120,7 +120,7 @@ jobs: sessioninfo::session_info(pkgs, include_base = TRUE) shell: Rscript {0} - - name: Run Check + - name: Run R CMD check env: _R_CHECK_CRAN_INCOMING_: false run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") diff --git a/DESCRIPTION b/DESCRIPTION index 2484b053..3b74194e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: AMR -Version: 1.4.0.9047 +Version: 1.4.0.9048 Date: 2020-12-27 Title: Antimicrobial Resistance Analysis Authors@R: c( @@ -29,6 +29,8 @@ Authors@R: c( family = "Meijer", given = c("Bart", "C."), email = "b.meijerg@certe.nl"), person(role = "ctb", family = "Ny", given = "Sofia", email = "sofia.ny@folkhalsomyndigheten.se"), + person(role = "ctb", + family = "Schade", given = c("Rogier", "P."), email = "r.schade@amsterdamumc.nl"), person(role = "ctb", family = "Souverein", given = "Dennis", email = "d.souvereing@streeklabhaarlem.nl"), person(role = "ctb", diff --git a/NEWS.md b/NEWS.md index 4be16f2a..3f264538 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 1.4.0.9047 +# AMR 1.4.0.9048 ## Last updated: 27 December 2020 ### New @@ -14,6 +14,7 @@ * Functions `random_mic()`, `random_disk()` and `random_rsi()` for random number generation. They take microorganism names and antibiotic names as input to make generation more realistic. ### Changed +* New argument `ampc_cephalosporin_resistance` in `eucast_rules()` to correct for AmpC de-repressed cephalosporin-resistant mutants * Interpretation of antimicrobial resistance - `as.rsi()`: * Reference data used for `as.rsi()` can now be set by the user, using the `reference_data` argument. This allows for using own interpretation guidelines. The user-set data must have the same structure as `rsi_translation`. * Better determination of disk zones and MIC values when running `as.rsi()` on a data.frame @@ -50,7 +51,8 @@ ### Other * All messages and warnings thrown by this package now break sentences on whole words * More extensive unit tests -* Internal calls to `options()` were all removed in favour of a new internal environment `mo_env` +* Internal calls to `options()` were all removed in favour of a new internal environment `pkg_env` +* Added Dr. Rogier Schade as contributor # AMR 1.4.0 diff --git a/R/episode.R b/R/episode.R index dd09cc44..ac26d5e0 100644 --- a/R/episode.R +++ b/R/episode.R @@ -50,7 +50,7 @@ #' get_episode(example_isolates$date, episode_days = 60) #' is_new_episode(example_isolates$date, episode_days = 60) #' -#' # filter on results from the third 60-day episode using base R +#' # filter on results from the third 60-day episode only, using base R #' example_isolates[which(get_episode(example_isolates$date, 60) == 3), ] #' #' \donttest{ diff --git a/R/eucast_rules.R b/R/eucast_rules.R index a8fbd45f..6983cc47 100755 --- a/R/eucast_rules.R +++ b/R/eucast_rules.R @@ -64,6 +64,7 @@ format_eucast_version_nr <- function(version, markdown = TRUE) { #' @param verbose a [logical] to turn Verbose mode on and off (default is off). In Verbose mode, the function does not apply rules to the data, but instead returns a data set in logbook form with extensive info about which rows and columns would be effected and in which way. Using Verbose mode takes a lot more time. #' @param version_breakpoints the version number to use for the EUCAST Clinical Breakpoints guideline. Currently supported: `r paste0(names(EUCAST_VERSION_BREAKPOINTS), collapse = ", ")`. #' @param version_expertrules the version number to use for the EUCAST Expert Rules and Intrinsic Resistance guideline. Currently supported: `r paste0(names(EUCAST_VERSION_EXPERT_RULES), collapse = ", ")`. +#' @param ampc_cephalosporin_resistance a character value that should be applied for AmpC de-repressed cephalosporin-resistant mutants, defaults to `NA`. Currently only works when `version_expertrules` is `3.2`; '*EUCAST Expert Rules v3.2 on Enterobacterales*' states that susceptible (S) results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these agents. A value of `NA` for this argument will remove results for these agents, while e.g. a value of `"R"` will make the results for these agents resistant. Use `NULL` to not alter the results for AmpC de-repressed cephalosporin-resistant mutants. \cr For *EUCAST Expert Rules* v3.2, this rule applies to: *`r gsub("|", "*, *", gsub("[)(^)]", "", eucast_rules_file[which(eucast_rules_file$reference.version == 3.2 & eucast_rules_file$reference.rule %like% "ampc"), "this_value"][1]), fixed = TRUE)`*. #' @param ... column name of an antibiotic, please see section *Antibiotics* below #' @inheritParams first_isolate #' @details @@ -149,6 +150,7 @@ eucast_rules <- function(x, verbose = FALSE, version_breakpoints = 10.0, version_expertrules = 3.2, + ampc_cephalosporin_resistance = NA, ...) { meet_criteria(x, allow_class = "data.frame") meet_criteria(col_mo, allow_class = "character", has_length = 1, is_in = colnames(x), allow_NULL = TRUE) @@ -157,6 +159,7 @@ eucast_rules <- function(x, meet_criteria(verbose, allow_class = "logical", has_length = 1) meet_criteria(version_breakpoints, allow_class = "numeric", has_length = 1) meet_criteria(version_expertrules, allow_class = "numeric", has_length = 1) + meet_criteria(ampc_cephalosporin_resistance, allow_class = c("rsi", "character"), has_length = 1, allow_NA = TRUE, allow_NULL = TRUE, is_in = c("R", "S", "I")) x_deparsed <- deparse(substitute(x)) if (length(x_deparsed) > 1 || !all(x_deparsed %like% "[a-z]+")) { @@ -731,7 +734,7 @@ eucast_rules <- function(x, # Official EUCAST rules --------------------------------------------------- eucast_notification_shown <- FALSE if (!is.null(list(...)$eucast_rules_df)) { - # this allows: eucast_rules(x, eucast_rules_df = AMR:::eucast_rules_file %pm>% filter(is.na(have_these_values))) + # this allows: eucast_rules(x, eucast_rules_df = AMR:::eucast_rules_file %>% filter(is.na(have_these_values))) eucast_rules_df <- list(...)$eucast_rules_df } else { # otherwise internal data file, created in data-raw/internals.R @@ -749,6 +752,13 @@ eucast_rules <- function(x, !reference.rule_group %like% "expert" | (reference.rule_group %like% "expert" & reference.version == version_expertrules)) } + # filter out AmpC de-repressed cephalosporin-resistant mutants ---- + if (is.null(ampc_cephalosporin_resistance)) { + eucast_rules_df <- subset(eucast_rules_df, + !reference.rule %like% "ampc") + } else { + eucast_rules_df[which(eucast_rules_df$reference.rule %like% "ampc"), "to_value"] <- as.character(ampc_cephalosporin_resistance) + } for (i in seq_len(nrow(eucast_rules_df))) { @@ -946,7 +956,7 @@ eucast_rules <- function(x, by = c(".rowid" = "rowid")) %pm>% pm_select(-`.rowid`) %pm>% pm_select(row, pm_everything()) %pm>% - pm_filter(!is.na(new)) %pm>% + pm_filter(!is.na(new) | is.na(new) & !is.na(old)) %pm>% pm_arrange(row, rule_group, rule_name, col) rownames(verbose_info) <- NULL } @@ -1007,6 +1017,7 @@ eucast_rules <- function(x, if (total_n_changed > 0) { changed_summary <- verbose_info %pm>% pm_filter(!is.na(old)) %pm>% + pm_mutate(new = ifelse(is.na(new), "NA", new)) %pm>% pm_count(old, new, name = "n") cat(paste(" -", paste0(formatnr(changed_summary$n), " test result", ifelse(changed_summary$n > 1, "s", ""), " changed from ", @@ -1092,7 +1103,7 @@ edit_rsi <- function(x, if (w$message %like% "invalid factor level") { xyz <- sapply(cols, function(col) { new_edits[, col] <<- factor(x = as.character(pm_pull(new_edits, col)), - levels = unique(c(to, levels(pm_pull(new_edits, col))))) + levels = unique(c(to, levels(pm_pull(new_edits, col))))) invisible() }) suppressWarnings(new_edits[rows, cols] <<- to) @@ -1134,7 +1145,7 @@ edit_rsi <- function(x, stringsAsFactors = FALSE) colnames(verbose_new) <- c("rowid", "col", "mo_fullname", "old", "new", "rule", "rule_group", "rule_name", "rule_source") - verbose_new <- verbose_new %pm>% pm_filter(old != new | is.na(old)) + verbose_new <- verbose_new %pm>% pm_filter(old != new | is.na(old) | is.na(new) & !is.na(old)) # save changes to data set 'verbose_info' track_changes$verbose_info <- rbind(track_changes$verbose_info, verbose_new, diff --git a/R/sysdata.rda b/R/sysdata.rda index 736d43dc..88761872 100644 Binary files a/R/sysdata.rda and b/R/sysdata.rda differ diff --git a/cran-comments.md b/cran-comments.md index 8b1a2ce1..823a18bb 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,3 +1 @@ -* Edited the unit tests, so they will run under 10 minutes on CRAN (using testthat::skip_on_cran() on some tests). - * Since version 0.3.0 (2018-08-14), CHECK returns a NOTE for having a data directory over 3 MB. This is needed to offer users reference data for the complete taxonomy of microorganisms - one of the most important features of this package. diff --git a/data-raw/eucast_rules.tsv b/data-raw/eucast_rules.tsv index 4ffbb0cf..2e2a6b7c 100644 --- a/data-raw/eucast_rules.tsv +++ b/data-raw/eucast_rules.tsv @@ -300,3 +300,6 @@ genus_species is Moraxella catarrhalis NAL S fluoroquinolones S Expert Rules on genus_species is Moraxella catarrhalis NAL R fluoroquinolones R Expert Rules on Moraxella catarrhalis Expert Rules 3.2 genus is Campylobacter ERY S CLR, AZM S Expert Rules on Campylobacter Expert Rules 3.2 genus_species is Campylobacter ERY R CLR, AZM R Expert Rules on Campylobacter Expert Rules 3.2 +fullname like ^(Enterobacter|Klebsiella aerogenes|Citrobacter freundii|Hafnia alvei|Serratia|Morganella morganii|Providencia) CTX S CTX, CRO, CAZ Expert Rules on Enterobacterales (AmpC de-repressed cephalosporins) Expert Rules 3.2 This is rule 3 and 4 of EUCAST Expert Rules v3.2 on Enterobacterales, result will be set with the 'ampc_derepressed_cephalosporins' argument +fullname like ^(Enterobacter|Klebsiella aerogenes|Citrobacter freundii|Hafnia alvei|Serratia|Morganella morganii|Providencia) CRO S CTX, CRO, CAZ Expert Rules on Enterobacterales (AmpC de-repressed cephalosporins) Expert Rules 3.2 This is rule 3 and 4 of EUCAST Expert Rules v3.2 on Enterobacterales, result will be set with the 'ampc_derepressed_cephalosporins' argument +fullname like ^(Enterobacter|Klebsiella aerogenes|Citrobacter freundii|Hafnia alvei|Serratia|Morganella morganii|Providencia) CAZ S CTX, CRO, CAZ Expert Rules on Enterobacterales (AmpC de-repressed cephalosporins) Expert Rules 3.2 This is rule 3 and 4 of EUCAST Expert Rules v3.2 on Enterobacterales, result will be set with the 'ampc_derepressed_cephalosporins' argument diff --git a/docs/404.html b/docs/404.html index 882bb89d..4463130d 100644 --- a/docs/404.html +++ b/docs/404.html @@ -81,7 +81,7 @@ AMR (for R) - 1.4.0.9047 + 1.4.0.9048 diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 9685c24b..5062e46c 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -81,7 +81,7 @@ AMR (for R) - 1.4.0.9047 + 1.4.0.9048 diff --git a/docs/articles/index.html b/docs/articles/index.html index 4d611988..476f5aa0 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.4.0.9047 + 1.4.0.9048 diff --git a/docs/authors.html b/docs/authors.html index 25fc26d4..b20f4ceb 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -81,7 +81,7 @@ AMR (for R) - 1.4.0.9047 + 1.4.0.9048 @@ -303,6 +303,10 @@

Sofia Ny. Contributor.

+
  • +

    Rogier P. Schade. Contributor. +

    +
  • Dennis Souverein. Contributor.

    diff --git a/docs/extra.js b/docs/extra.js index 78f0d9dd..bc54c5de 100644 --- a/docs/extra.js +++ b/docs/extra.js @@ -90,6 +90,7 @@ $(document).ready(function() { x = x.replace("Judith", "Dr. Judith"); x = x.replace("Gwen", "Dr. Gwen"); x = x.replace("Anthony", "Dr. Anthony"); + x = x.replace("Rogier", "Dr. Rogier"); } return(x); } diff --git a/docs/index.html b/docs/index.html index 106a5fd4..8f53a05a 100644 --- a/docs/index.html +++ b/docs/index.html @@ -43,7 +43,7 @@ AMR (for R) - 1.4.0.9047 + 1.4.0.9048 diff --git a/docs/news/index.html b/docs/news/index.html index 145d0592..49165a29 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.4.0.9047 + 1.4.0.9048 @@ -236,9 +236,9 @@ Source: NEWS.md -
    -

    -AMR 1.4.0.9047 Unreleased +
    +

    +AMR 1.4.0.9048 Unreleased

    @@ -266,6 +266,7 @@

    Changed

      +
    • New argument ampc_cephalosporin_resistance in eucast_rules() to correct for AmpC de-repressed cephalosporin-resistant mutants

    • Interpretation of antimicrobial resistance - as.rsi():

        @@ -313,8 +314,9 @@
        • All messages and warnings thrown by this package now break sentences on whole words
        • More extensive unit tests
        • -
        • Internal calls to options() were all removed in favour of a new internal environment mo_env +
        • Internal calls to options() were all removed in favour of a new internal environment pkg_env
        • +
        • Added Dr. Rogier Schade as contributor
    diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 8245974d..dd910b3e 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -12,7 +12,7 @@ articles: datasets: datasets.html resistance_predict: resistance_predict.html welcome_to_AMR: welcome_to_AMR.html -last_built: 2020-12-26T23:29Z +last_built: 2020-12-27T13:22Z urls: reference: https://msberends.github.io/AMR//reference article: https://msberends.github.io/AMR//articles diff --git a/docs/reference/eucast_rules.html b/docs/reference/eucast_rules.html index 07386e56..a8c2e140 100644 --- a/docs/reference/eucast_rules.html +++ b/docs/reference/eucast_rules.html @@ -83,7 +83,7 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied AMR (for R) - 1.4.0.9046 + 1.4.0.9048

    @@ -252,6 +252,7 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied verbose = FALSE, version_breakpoints = 10, version_expertrules = 3.2, + ampc_cephalosporin_resistance = NA, ... ) @@ -286,6 +287,10 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied version_expertrules

    the version number to use for the EUCAST Expert Rules and Intrinsic Resistance guideline. Currently supported: 3.1, 3.2.

    + + ampc_cephalosporin_resistance +

    a character value that should be applied for AmpC de-repressed cephalosporin-resistant mutants, defaults to NA. Currently only works when version_expertrules is 3.2; 'EUCAST Expert Rules v3.2 on Enterobacterales' states that susceptible (S) results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these agents. A value of NA for this argument will remove results for these agents, while e.g. a value of "R" will make the results for these agents resistant. Use NULL to not alter the results for AmpC de-repressed cephalosporin-resistant mutants.
    For EUCAST Expert Rules v3.2, this rule applies to: Enterobacter, Klebsiella aerogenes, Citrobacter freundii, Hafnia alvei, Serratia, Morganella morganii, Providencia.

    + ...

    column name of an antibiotic, please see section Antibiotics below

    diff --git a/docs/reference/get_episode.html b/docs/reference/get_episode.html index 9d14c8cd..2c7c1684 100644 --- a/docs/reference/get_episode.html +++ b/docs/reference/get_episode.html @@ -82,7 +82,7 @@ AMR (for R) - 1.4.0.9046 + 1.4.0.9048 @@ -275,7 +275,7 @@

    Dates are first sorted from old to new. The oldest date will mark the start of the first episode. After this date, the next date will be marked that is at least episode_days days later than the start of the first episode. From that second marked date on, the next date will be marked that is at least episode_days days later than the start of the second episode which will be the start of the third episode, and so on. Before the vector is being returned, the original order will be restored.

    The first_isolate() function is a wrapper around the is_new_episode() function, but is more efficient for data sets containing microorganism codes or names.

    -

    The dplyr package is not required for these functions to work, but these functions support variable grouping and work conveniently inside dplyr verbs such as filter(), mutate() and summarise().

    +

    The dplyr package is not required for these functions to work, but these functions support variable grouping and work conveniently inside dplyr verbs such as filter(), mutate() and summarise().

    Stable lifecycle

    @@ -299,7 +299,7 @@ The lifecycle of this function is stableget_episode(example_isolates$date, episode_days = 60) is_new_episode(example_isolates$date, episode_days = 60) -# filter on results from the third 60-day episode using base R +# filter on results from the third 60-day episode only, using base R example_isolates[which(get_episode(example_isolates$date, 60) == 3), ] # \donttest{ @@ -307,23 +307,23 @@ The lifecycle of this function is stable# is_new_episode() can also be used in dplyr verbs to determine patient # episodes based on any (combination of) grouping variables: example_isolates %>% - mutate(condition = sample(x = c("A", "B", "C"), + mutate(condition = sample(x = c("A", "B", "C"), size = 2000, replace = TRUE)) %>% - group_by(condition) %>% - mutate(new_episode = is_new_episode(date, 365)) + group_by(condition) %>% + mutate(new_episode = is_new_episode(date, 365)) example_isolates %>% - group_by(hospital_id, patient_id) %>% - transmute(date, + group_by(hospital_id, patient_id) %>% + transmute(date, patient_id, new_index = get_episode(date, 60), new_logical = is_new_episode(date, 60)) example_isolates %>% - group_by(hospital_id) %>% - summarise(patients = n_distinct(patient_id), + group_by(hospital_id) %>% + summarise(patients = n_distinct(patient_id), n_episodes_365 = sum(is_new_episode(date, episode_days = 365)), n_episodes_60 = sum(is_new_episode(date, episode_days = 60)), n_episodes_30 = sum(is_new_episode(date, episode_days = 30))) @@ -332,19 +332,19 @@ The lifecycle of this function is stable# grouping on patients and microorganisms leads to the same results # as first_isolate(): x <- example_isolates %>% - filter(first_isolate(., include_unknown = TRUE)) + filter(first_isolate(., include_unknown = TRUE)) y <- example_isolates %>% - group_by(patient_id, mo) %>% - filter(is_new_episode(date, 365)) + group_by(patient_id, mo) %>% + filter(is_new_episode(date, 365)) identical(x$patient_id, y$patient_id) # but is_new_episode() has a lot more flexibility than first_isolate(), # since you can now group on anything that seems relevant: example_isolates %>% - group_by(patient_id, mo, hospital_id, ward_icu) %>% - mutate(flag_episode = is_new_episode(date, 365)) + group_by(patient_id, mo, hospital_id, ward_icu) %>% + mutate(flag_episode = is_new_episode(date, 365)) } # } diff --git a/docs/reference/index.html b/docs/reference/index.html index a0f7e853..d84f7781 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.4.0.9047 + 1.4.0.9048 diff --git a/docs/survey.html b/docs/survey.html index 47f325b4..7c11af22 100644 --- a/docs/survey.html +++ b/docs/survey.html @@ -81,7 +81,7 @@ AMR (for R) - 1.4.0.9047 + 1.4.0.9048 diff --git a/man/eucast_rules.Rd b/man/eucast_rules.Rd index cd129781..89d571db 100644 --- a/man/eucast_rules.Rd +++ b/man/eucast_rules.Rd @@ -23,6 +23,7 @@ eucast_rules( verbose = FALSE, version_breakpoints = 10, version_expertrules = 3.2, + ampc_cephalosporin_resistance = NA, ... ) } @@ -41,6 +42,8 @@ eucast_rules( \item{version_expertrules}{the version number to use for the EUCAST Expert Rules and Intrinsic Resistance guideline. Currently supported: 3.1, 3.2.} +\item{ampc_cephalosporin_resistance}{a character value that should be applied for AmpC de-repressed cephalosporin-resistant mutants, defaults to \code{NA}. Currently only works when \code{version_expertrules} is \code{3.2}; '\emph{EUCAST Expert Rules v3.2 on Enterobacterales}' states that susceptible (S) results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these agents. A value of \code{NA} for this argument will remove results for these agents, while e.g. a value of \code{"R"} will make the results for these agents resistant. Use \code{NULL} to not alter the results for AmpC de-repressed cephalosporin-resistant mutants. \cr For \emph{EUCAST Expert Rules} v3.2, this rule applies to: \emph{Enterobacter}, \emph{Klebsiella aerogenes}, \emph{Citrobacter freundii}, \emph{Hafnia alvei}, \emph{Serratia}, \emph{Morganella morganii}, \emph{Providencia}.} + \item{...}{column name of an antibiotic, please see section \emph{Antibiotics} below} } \value{ diff --git a/man/get_episode.Rd b/man/get_episode.Rd index 9e478c7d..ecab0ae6 100644 --- a/man/get_episode.Rd +++ b/man/get_episode.Rd @@ -52,7 +52,7 @@ On our website \url{https://msberends.github.io/AMR/} you can find \href{https:/ get_episode(example_isolates$date, episode_days = 60) is_new_episode(example_isolates$date, episode_days = 60) -# filter on results from the third 60-day episode using base R +# filter on results from the third 60-day episode only, using base R example_isolates[which(get_episode(example_isolates$date, 60) == 3), ] \donttest{ diff --git a/pkgdown/extra.js b/pkgdown/extra.js index 78f0d9dd..bc54c5de 100644 --- a/pkgdown/extra.js +++ b/pkgdown/extra.js @@ -90,6 +90,7 @@ $(document).ready(function() { x = x.replace("Judith", "Dr. Judith"); x = x.replace("Gwen", "Dr. Gwen"); x = x.replace("Anthony", "Dr. Anthony"); + x = x.replace("Rogier", "Dr. Rogier"); } return(x); } diff --git a/tests/testthat/test-eucast_rules.R b/tests/testthat/test-eucast_rules.R index 7c188867..575ace55 100755 --- a/tests/testthat/test-eucast_rules.R +++ b/tests/testthat/test-eucast_rules.R @@ -118,4 +118,24 @@ test_that("EUCAST rules work", { # check verbose output expect_output(suppressWarnings(eucast_rules(example_isolates, verbose = TRUE, rules = "all", info = TRUE))) + # AmpC de-repressed cephalo mutants + expect_identical( + eucast_rules(data.frame(mo = c("Escherichia coli", "Enterobacter cloacae"), + cefotax = as.rsi(c("S", "S"))), + ampc_derepressed_cephalosporins = "R", + info = FALSE)$cefotax, + as.rsi(c("S", "R"))) + expect_identical( + eucast_rules(data.frame(mo = c("Escherichia coli", "Enterobacter cloacae"), + cefotax = as.rsi(c("S", "S"))), + ampc_derepressed_cephalosporins = NA, + info = FALSE)$cefotax, + as.rsi(c("S", NA))) + expect_identical( + eucast_rules(data.frame(mo = c("Escherichia coli", "Enterobacter cloacae"), + cefotax = as.rsi(c("S", "S"))), + ampc_derepressed_cephalosporins = NULL, + info = FALSE)$cefotax, + as.rsi(c("S", "S"))) + })