diff --git a/DESCRIPTION b/DESCRIPTION index d851c682..2e6819f0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 0.7.1.9098 -Date: 2019-10-07 +Version: 0.7.1.9100 +Date: 2019-10-08 Title: Antimicrobial Resistance Analysis Authors@R: c( person(role = c("aut", "cre"), diff --git a/NEWS.md b/NEWS.md index 19ef8f91..6f8699d5 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,5 @@ -# AMR 0.7.1.9098 -Last updated: 07-Oct-2019 +# AMR 0.7.1.9100 +Last updated: 08-Oct-2019 ### Breaking * Determination of first isolates now **excludes** all 'unknown' microorganisms at default, i.e. microbial code `"UNKNOWN"`. They can be included with the new parameter `include_unknown`: @@ -121,6 +121,7 @@ * Fix for `key_antibiotics()` on foreign systems * Added 80 new LIS codes for microorganisms * Relabeled the factor levels of `mdr_tb()` +* Added more MIC factor levels (`as.mic()`) #### Other * Added Prof. Dr. Casper Albers as doctoral advisor and added Dr. Judith Fonville, Eric Hazenberg, Dr. Bart Meijer, Dr. Dennis Souverein and Annick Lenglet as contributors diff --git a/R/ab_property.R b/R/ab_property.R index 614ab3ec..b62e2acb 100644 --- a/R/ab_property.R +++ b/R/ab_property.R @@ -181,12 +181,12 @@ ab_validate <- function(x, property, ...) { library("AMR") # check onLoad() in R/zzz.R: data tables are created there. } - + # try to catch an error when inputting an invalid parameter # so the 'call.' can be set to FALSE tryCatch(x[1L] %in% AMR::antibiotics[1, property], error = function(e) stop(e$message, call. = FALSE)) - + x_bak <- x if (!all(x %in% AMR::antibiotics[, property])) { x <- data.frame(ab = AMR::as.ab(x, ...), stringsAsFactors = FALSE) %>% left_join(AMR::antibiotics, by = "ab") %>% @@ -199,6 +199,8 @@ ab_validate <- function(x, property, ...) { } else if (property %like% "ddd") { return(as.double(x)) } else { + # return "(input)" for NAs + x[is.na(x) & !is.na(x_bak)] <- paste0("(", x_bak[is.na(x) & !is.na(x_bak)], ")") return(x) } } diff --git a/R/bug_drug_combinations.R b/R/bug_drug_combinations.R index 1fd726a3..26430d6e 100644 --- a/R/bug_drug_combinations.R +++ b/R/bug_drug_combinations.R @@ -39,6 +39,7 @@ #' The language of the output can be overwritten with \code{options(AMR_locale)}, please see \link{translate}. #' @export #' @rdname bug_drug_combinations +#' @return The function \code{bug_drug_combinations} returns a \code{data.frame} with columns "mo", "ab", "S", "I", "R" and "total". #' @source \strong{M39 Analysis and Presentation of Cumulative Antimicrobial Susceptibility Test Data, 4th Edition}, 2014, \emph{Clinical and Laboratory Standards Institute (CLSI)}. \url{https://clsi.org/standards/products/microbiology/documents/m39/}. #' @inheritSection AMR Read more on our website! #' @examples @@ -58,7 +59,6 @@ #' } bug_drug_combinations <- function(x, col_mo = NULL, - minimum = 30, FUN = mo_shortname, ...) { if (!is.data.frame(x)) { @@ -77,17 +77,17 @@ bug_drug_combinations <- function(x, x <- x %>% as.data.frame(stringsAsFactors = FALSE) %>% mutate(mo = x %>% pull(col_mo) %>% FUN(...)) %>% - filter(mo %in% (freq(mo) %>% - filter(count >= minimum) %>% - pull(item))) %>% group_by(mo) %>% - AMR::rsi_df(translate_ab = FALSE, combine_SI = FALSE) %>% - select(-value) %>% - spread(interpretation, isolates) %>% + select_if(is.rsi) %>% + gather("ab", "value", -mo) %>% + group_by(mo, ab) %>% + summarise(S = sum(value == "S", na.rm = TRUE), + I = sum(value == "I", na.rm = TRUE), + R = sum(value == "R", na.rm = TRUE)) %>% + ungroup() %>% mutate(total = S + I + R) %>% - filter(total >= minimum) %>% - rename(ab = antibiotic) - + as.data.frame(stringsAsFactors = FALSE) + structure(.Data = x, class = c("bug_drug_combinations", class(x))) } @@ -107,6 +107,8 @@ format.bug_drug_combinations <- function(x, decimal.mark = getOption("OutDec"), big.mark = ifelse(decimal.mark == ",", ".", ","), ...) { + x <- x %>% filter(total >= minimum) + if (remove_intrinsic_resistant == TRUE) { x <- x %>% filter(R != total) } @@ -133,7 +135,6 @@ format.bug_drug_combinations <- function(x, } y <- x %>% - filter(total >= minimum) %>% mutate(ab = as.ab(ab), ab_txt = give_ab_name(ab = ab, format = translate_ab, language = language)) %>% group_by(ab, ab_txt, mo) %>% diff --git a/R/eucast_rules.R b/R/eucast_rules.R index ce75cdb1..70c6acde 100755 --- a/R/eucast_rules.R +++ b/R/eucast_rules.R @@ -429,7 +429,7 @@ eucast_rules <- function(x, x_original <<- x_original %>% mutate_at(vars(cols), ~factor(x = as.character(.), levels = c(to, levels(.)))) x <<- x %>% mutate_at(vars(cols), ~factor(x = as.character(.), levels = c(to, levels(.)))) x_original[rows, cols] <<- to - warning('Value "', to, '" added to the factor levels of column(s) `', paste(cols, collapse = '`, `'), '` because this value was not an existing factor level.\nA better way is to use as.rsi() on beforehand on antibiotic columns to guarantee the right structure.', call. = FALSE) + warning('Value "', to, '" added to the factor levels of column(s) `', paste(cols, collapse = '`, `'), '` because this value was not an existing factor level.\nA better way is to use as.rsi() on beforehand on antimicrobial columns to guarantee the right structure.', call. = FALSE) txt_warning() warned <<- FALSE } else { diff --git a/R/guess_ab_col.R b/R/guess_ab_col.R index 15435717..35a7c170 100755 --- a/R/guess_ab_col.R +++ b/R/guess_ab_col.R @@ -130,7 +130,7 @@ get_column_abx <- function(x, # and that have no more than 50% invalid values vectr_antibiotics <- unique(toupper(unlist(AMR::antibiotics[,c("ab", "atc", "name", "abbreviations", "synonyms")]))) vectr_antibiotics <- vectr_antibiotics[!is.na(vectr_antibiotics) & nchar(vectr_antibiotics) >= 3] - x_columns <- sapply(colnames(x), function(col = x, df = x_bak) { + x_columns <- sapply(colnames(x), function(col, df = x_bak) { if (toupper(col) %in% vectr_antibiotics | is.rsi(as.data.frame(df)[, col]) | is.rsi.eligible(as.data.frame(df)[, col], threshold = 0.5)) { @@ -139,9 +139,9 @@ get_column_abx <- function(x, return(NA_character_) } }) - x_coluxmns <- x_columns[!is.na(x_columns)] - x <- x[,x_columns[!is.na(x_columns)]] - + x_columns <- x_columns[!is.na(x_columns)] + x <- x[, x_columns, drop = FALSE] # without drop = TRUE, x will become a vector when x_columns is length 1 + df_trans <- data.frame(colnames = colnames(x), abcode = suppressWarnings(as.ab(colnames(x)))) df_trans <- df_trans[!is.na(df_trans$abcode),] diff --git a/R/mic.R b/R/mic.R index 2b0d36d2..56d60b56 100755 --- a/R/mic.R +++ b/R/mic.R @@ -68,6 +68,9 @@ as.mic <- function(x, na.rm = FALSE) { x <- gsub(',', '.', x, fixed = TRUE) # remove space between operator and number ("<= 0.002" -> "<=0.002") x <- gsub('(<|=|>) +', '\\1', x) + # transform => to >= and =< to <= + x <- gsub('=>', '>=', x, fixed = TRUE) + x <- gsub('=<', '<=', x, fixed = TRUE) # starting dots must start with 0 x <- gsub('^[.]+', '0.', x) # <=0.2560.512 should be 0.512 @@ -76,13 +79,19 @@ as.mic <- function(x, na.rm = FALSE) { x <- gsub('[.]+0$', '', x) # remove all after last digit x <- gsub('[^0-9]+$', '', x) + # keep only one zero before dot + x <- gsub("0+[.]", "0.", x) + # starting 00 is probably 0.0 if there's no dot yet + x[!x %like% "[.]"] <- gsub("^00", "0.0", x[!x %like% "[.]"]) # remove last zeroes x <- gsub('([.].?)0+$', '\\1', x) x <- gsub('(.*[.])0+$', '\\10', x) # remove ending .0 again - x <- gsub('[.]+0$', '', x) + x[x %like% "[.]"] <- gsub('0+$', '', x[x %like% "[.]"]) # force to be character x <- as.character(x) + # trim it + x <- trimws(x) ## previously unempty values now empty - should return a warning later on x[x.bak != "" & x == ""] <- "invalid" @@ -92,15 +101,25 @@ as.mic <- function(x, na.rm = FALSE) { "<0.002", "<=0.002", "0.002", ">=0.002", ">0.002", "<0.003", "<=0.003", "0.003", ">=0.003", ">0.003", "<0.004", "<=0.004", "0.004", ">=0.004", ">0.004", + "<0.005", "<=0.005", "0.005", ">=0.005", ">0.005", "<0.006", "<=0.006", "0.006", ">=0.006", ">0.006", + "<0.007", "<=0.007", "0.007", ">=0.007", ">0.007", "<0.008", "<=0.008", "0.008", ">=0.008", ">0.008", + "<0.009", "<=0.009", "0.009", ">=0.009", ">0.009", + "<0.01", "<=0.01", "0.01", ">=0.01", ">0.01", "<0.012", "<=0.012", "0.012", ">=0.012", ">0.012", "<0.0125", "<=0.0125", "0.0125", ">=0.0125", ">0.0125", "<0.016", "<=0.016", "0.016", ">=0.016", ">0.016", + "<0.019", "<=0.019", "0.019", ">=0.019", ">0.019", + "<0.02", "<=0.02", "0.02", ">=0.02", ">0.02", "<0.023", "<=0.023", "0.023", ">=0.023", ">0.023", "<0.025", "<=0.025", "0.025", ">=0.025", ">0.025", + "<0.028", "<=0.028", "0.028", ">=0.028", ">0.028", "<0.03", "<=0.03", "0.03", ">=0.03", ">0.03", + "<0.031", "<=0.031", "0.031", ">=0.031", ">0.031", "<0.032", "<=0.032", "0.032", ">=0.032", ">0.032", + "<0.038", "<=0.038", "0.038", ">=0.038", ">0.038", + "<0.04", "<=0.04", "0.04", ">=0.04", ">0.04", "<0.047", "<=0.047", "0.047", ">=0.047", ">0.047", "<0.05", "<=0.05", "0.05", ">=0.05", ">0.05", "<0.054", "<=0.054", "0.054", ">=0.054", ">0.054", @@ -108,25 +127,38 @@ as.mic <- function(x, na.rm = FALSE) { "<0.0625", "<=0.0625", "0.0625", ">=0.0625", ">0.0625", "<0.063", "<=0.063", "0.063", ">=0.063", ">0.063", "<0.064", "<=0.064", "0.064", ">=0.064", ">0.064", + "<0.075", "<=0.075", "0.075", ">=0.075", ">0.075", + "<0.08", "<=0.08", "0.08", ">=0.08", ">0.08", "<0.09", "<=0.09", "0.09", ">=0.09", ">0.09", "<0.094", "<=0.094", "0.094", ">=0.094", ">0.094", + "<0.095", "<=0.095", "0.095", ">=0.095", ">0.095", + "<0.1", "<=0.1", "0.1", ">=0.1", ">0.1", "<0.12", "<=0.12", "0.12", ">=0.12", ">0.12", "<0.125", "<=0.125", "0.125", ">=0.125", ">0.125", "<0.128", "<=0.128", "0.128", ">=0.128", ">0.128", + "<0.15", "<=0.15", "0.15", ">=0.15", ">0.15", "<0.16", "<=0.16", "0.16", ">=0.16", ">0.16", + "<0.17", "<=0.17", "0.17", ">=0.17", ">0.17", + "<0.18", "<=0.18", "0.18", ">=0.18", ">0.18", "<0.19", "<=0.19", "0.19", ">=0.19", ">0.19", + "<0.2", "<=0.2", "0.2", ">=0.2", ">0.2", "<0.23", "<=0.23", "0.23", ">=0.23", ">0.23", "<0.25", "<=0.25", "0.25", ">=0.25", ">0.25", "<0.256", "<=0.256", "0.256", ">=0.256", ">0.256", "<0.28", "<=0.28", "0.28", ">=0.28", ">0.28", "<0.3", "<=0.3", "0.3", ">=0.3", ">0.3", "<0.32", "<=0.32", "0.32", ">=0.32", ">0.32", + "<0.35", "<=0.35", "0.35", ">=0.35", ">0.35", "<0.36", "<=0.36", "0.36", ">=0.36", ">0.36", "<0.38", "<=0.38", "0.38", ">=0.38", ">0.38", + "<0.47", "<=0.47", "0.47", ">=0.47", ">0.47", "<0.5", "<=0.5", "0.5", ">=0.5", ">0.5", "<0.512", "<=0.512", "0.512", ">=0.512", ">0.512", "<0.64", "<=0.64", "0.64", ">=0.64", ">0.64", + "<0.73", "<=0.73", "0.73", ">=0.73", ">0.73", "<0.75", "<=0.75", "0.75", ">=0.75", ">0.75", + "<0.8", "<=0.8", "0.8", ">=0.8", ">0.8", + "<0.94", "<=0.94", "0.94", ">=0.94", ">0.94", "<1", "<=1", "1", ">=1", ">1", "<1.5", "<=1.5", "1.5", ">=1.5", ">1.5", "<2", "<=2", "2", ">=2", ">2", diff --git a/R/mo.R b/R/mo.R index d4f8ca1a..524d19a1 100755 --- a/R/mo.R +++ b/R/mo.R @@ -412,13 +412,13 @@ exec_as.mo <- function(x, y <- reference_data_to_use[prevalence == 1][data.table(mo = x), on = "mo", ..property][[1]] if (any(is.na(y))) { y[is.na(y)] <- reference_data_to_use[prevalence == 2][data.table(mo = x[is.na(y)]), - on = "mo", - ..property][[1]] + on = "mo", + ..property][[1]] } if (any(is.na(y))) { y[is.na(y)] <- reference_data_to_use[prevalence == 3][data.table(mo = x[is.na(y)]), - on = "mo", - ..property][[1]] + on = "mo", + ..property][[1]] } x <- y @@ -441,13 +441,13 @@ exec_as.mo <- function(x, y <- reference_data_to_use[prevalence == 1][data.table(fullname_lower = tolower(x)), on = "fullname_lower", ..property][[1]] if (any(is.na(y))) { y[is.na(y)] <- reference_data_to_use[prevalence == 2][data.table(fullname_lower = tolower(x[is.na(y)])), - on = "fullname_lower", - ..property][[1]] + on = "fullname_lower", + ..property][[1]] } if (any(is.na(y))) { y[is.na(y)] <- reference_data_to_use[prevalence == 3][data.table(fullname_lower = tolower(x[is.na(y)])), - on = "fullname_lower", - ..property][[1]] + on = "fullname_lower", + ..property][[1]] } x <- y @@ -548,7 +548,7 @@ exec_as.mo <- function(x, x[nchar(x_backup_without_spp) > 10] <- gsub("[+]", paste0("+[", constants, "]?"), x[nchar(x_backup_without_spp) > 10]) } x <- strip_whitespace(x, dyslexia_mode) - + x_trimmed <- x x_trimmed_species <- paste(x_trimmed, "species") x_trimmed_without_group <- gsub(" gro.u.p$", "", x_trimmed) @@ -1067,9 +1067,9 @@ exec_as.mo <- function(x, ref_old = found[1, ref], ref_new = microorganismsDT[col_id == found[1, col_id_new], ref], mo = microorganismsDT[col_id == found[1, col_id_new], mo]) - if (initial_search == TRUE) { - set_mo_history(a.x_backup, get_mo_code(x[i], property), 0, force = force_mo_history, disable = disable_mo_history) - } + # if (initial_search == TRUE) { + # set_mo_history(a.x_backup, get_mo_code(x[i], property), 0, force = force_mo_history, disable = disable_mo_history) + # } return(x[i]) } @@ -1099,7 +1099,7 @@ exec_as.mo <- function(x, message("Running '", d.x_withspaces_start_end, "' and '", e.x_withspaces_start_only, "'") } found <- data.old_to_check[fullname_lower %like_case% d.x_withspaces_start_end - | fullname_lower %like_case% e.x_withspaces_start_only] + | fullname_lower %like_case% e.x_withspaces_start_only] if (NROW(found) > 0 & nchar(g.x_backup_without_spp) >= 6) { if (property == "ref") { # when property is "ref" (which is the case in mo_ref, mo_authors and mo_year), return the old value, so: @@ -1119,9 +1119,9 @@ exec_as.mo <- function(x, format_uncertainty_as_df(uncertainty_level = now_checks_for_uncertainty_level, input = a.x_backup, result_mo = microorganismsDT[col_id == found[1, col_id_new], mo])) - if (initial_search == TRUE) { - set_mo_history(a.x_backup, get_mo_code(x, property), 1, force = force_mo_history, disable = disable_mo_history) - } + # if (initial_search == TRUE) { + # set_mo_history(a.x_backup, get_mo_code(x, property), 1, force = force_mo_history, disable = disable_mo_history) + # } return(x) } @@ -1520,7 +1520,7 @@ exec_as.mo <- function(x, # THEN TRY PREVALENT IN HUMAN INFECTIONS ---- x[i] <- check_per_prevalence(data_to_check = reference_data_to_use[prevalence == 2], data.old_to_check = microorganisms.oldDT[prevalence %in% c(2, 3)], # run all other old MOs the second time, - # otherwise e.g. mo_ref("Chlamydia psittaci") doesn't work correctly + # otherwise e.g. mo_ref("Chlamydia psittaci") doesn't work correctly a.x_backup = x_backup[i], b.x_trimmed = x_trimmed[i], c.x_trimmed_without_group = x_trimmed_without_group[i], @@ -1931,12 +1931,12 @@ print.mo_renamed <- function(x, ...) { } for (i in 1:nrow(x)) { message(blue(paste0("NOTE: ", - italic(x$old_name[i]), ifelse(x$old_ref[i] %in% c("", NA), "", - paste0(" (", gsub("et al.", italic("et al."), x$old_ref[i]), ")")), - " was renamed ", - italic(x$new_name[i]), ifelse(x$new_ref[i] %in% c("", NA), "", - paste0(" (", gsub("et al.", italic("et al."), x$new_ref[i]), ")")), - " [", x$mo[i], "]"))) + italic(x$old_name[i]), ifelse(x$old_ref[i] %in% c("", NA), "", + paste0(" (", gsub("et al.", italic("et al."), x$old_ref[i]), ")")), + " was renamed ", + italic(x$new_name[i]), ifelse(x$new_ref[i] %in% c("", NA), "", + paste0(" (", gsub("et al.", italic("et al."), x$new_ref[i]), ")")), + " [", x$mo[i], "]"))) } } diff --git a/data-raw/reproduction_of_antibiotics.R b/data-raw/reproduction_of_antibiotics.R index 78f34089..782ef4a9 100644 --- a/data-raw/reproduction_of_antibiotics.R +++ b/data-raw/reproduction_of_antibiotics.R @@ -279,6 +279,7 @@ antibiotics <- abx2 %>% antibiotics[which(antibiotics$ab == "DOX"), "abbreviations"][[1]] <- list(c("dox", "doxy")) antibiotics[which(antibiotics$ab == "FLC"), "abbreviations"][[1]] <- list(c("clox")) antibiotics[which(antibiotics$ab == "CEC"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CEC"), "abbreviations"][[1]], "CFC")) # cefaclor old WHONET4 code +antibiotics[which(antibiotics$ab == "AMX"), "synonyms"][[1]] <- list(sort(c(antibiotics[which(antibiotics$ab == "AMX"), "synonyms"][[1]], "Amoxy"))) # 'Polymixin B' (POL) and 'Polymyxin B' (PLB) both exist, so: antibiotics[which(antibiotics$ab == "PLB"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "PLB"), "abbreviations"][[1]], "POL", "Polymixin", "Polymixin B")) antibiotics <- filter(antibiotics, ab != "POL") @@ -303,6 +304,10 @@ antibiotics[which(antibiotics$ab == "CPC"), "abbreviations"][[1]] <- list(c("xpm antibiotics[which(antibiotics$ab == "FEP"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "FEP"), "abbreviations"][[1]], "xpm")) antibiotics[which(antibiotics$ab == "CTC"), "abbreviations"][[1]] <- list(c("xctl")) antibiotics[which(antibiotics$ab == "CTX"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CTX"), "abbreviations"][[1]], "xct")) +# High level Gentamcin and Streptomycin +antibiotics[which(antibiotics$ab == "GEH"), "abbreviations"][[1]] <- list(c("gehl")) +antibiotics[which(antibiotics$ab == "STH"), "abbreviations"][[1]] <- list(c("sthl")) + antibiotics <- antibiotics %>% arrange(name) diff --git a/data/antibiotics.rda b/data/antibiotics.rda index 169e04d2..a1d088c1 100755 Binary files a/data/antibiotics.rda and b/data/antibiotics.rda differ diff --git a/data/rsi_translation.rda b/data/rsi_translation.rda index e59fad0b..666a6d56 100644 Binary files a/data/rsi_translation.rda and b/data/rsi_translation.rda differ diff --git a/docs/404.html b/docs/404.html index 3803545d..d504f837 100644 --- a/docs/404.html +++ b/docs/404.html @@ -84,7 +84,7 @@ AMR (for R) - 0.7.1.9098 + 0.7.1.9100 diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 089f54fa..231ac608 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -84,7 +84,7 @@ AMR (for R) - 0.7.1.9098 + 0.7.1.9100 diff --git a/docs/articles/index.html b/docs/articles/index.html index c7cea356..b444a759 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -84,7 +84,7 @@ AMR (for R) - 0.7.1.9098 + 0.7.1.9100 diff --git a/docs/authors.html b/docs/authors.html index 9170d5d1..d11f0d35 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -84,7 +84,7 @@ AMR (for R) - 0.7.1.9098 + 0.7.1.9100 diff --git a/docs/index.html b/docs/index.html index 3a81e570..13c45dbf 100644 --- a/docs/index.html +++ b/docs/index.html @@ -43,7 +43,7 @@ AMR (for R) - 0.7.1.9098 + 0.7.1.9100 diff --git a/docs/news/index.html b/docs/news/index.html index 1f6e4004..68e37b17 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -84,7 +84,7 @@ AMR (for R) - 0.7.1.9098 + 0.7.1.9100 @@ -231,11 +231,11 @@ -
+

-AMR 0.7.1.9098 Unreleased +AMR 0.7.1.9100 Unreleased

-

Last updated: 07-Oct-2019

+

Last updated: 08-Oct-2019

Breaking

@@ -370,6 +370,7 @@ Since this is a major change, usage of the old also_single_tested w
  • Added 80 new LIS codes for microorganisms
  • Relabeled the factor levels of mdr_tb()
  • +
  • Added more MIC factor levels (as.mic())
  • @@ -1289,7 +1290,7 @@ Using as.mo(..., allow_uncertain = 3)

    Contents

    @@ -237,8 +237,7 @@

    Determine antimicrobial resistance (AMR) of all bug-drug combinations in your data set where at least 30 (default) isolates are available per species. Use format on the result to prettify it to a publicable/printable format, see Examples.

    -
    bug_drug_combinations(x, col_mo = NULL, minimum = 30,
    -  FUN = mo_shortname, ...)
    +    
    bug_drug_combinations(x, col_mo = NULL, FUN = mo_shortname, ...)
     
     # S3 method for bug_drug_combinations
     format(x,
    @@ -259,10 +258,6 @@
           col_mo
           

    column name of the IDs of the microorganisms (see as.mo), defaults to the first column of class mo. Values will be coerced using as.mo.

    - - minimum -

    the minimum allowed number of available (tested) isolates. Any isolate count lower than minimum will return NA with a warning. The default number of 30 isolates is advised by the Clinical and Laboratory Standards Institute (CLSI) as best practice, see Source.

    - FUN

    the function to call on the mo column to transform the microorganism IDs, defaults to mo_shortname

    @@ -279,6 +274,10 @@ language

    language of the returned text, defaults to system language (see get_locale) and can also be set with getOption("AMR_locale"). Use language = NULL or language = "" to prevent translation.

    + + minimum +

    the minimum allowed number of available (tested) isolates. Any isolate count lower than minimum will return NA with a warning. The default number of 30 isolates is advised by the Clinical and Laboratory Standards Institute (CLSI) as best practice, see Source.

    + combine_SI

    a logical to indicate whether all values of S and I must be merged into one, so the output only consists of S+I vs. R (susceptible vs. resistant). This used to be the parameter combine_IR, but this now follows the redefinition by EUCAST about the interpretion of I (increased exposure) in 2019, see section 'Interpretation of S, I and R' below. Default is TRUE.

    @@ -311,6 +310,9 @@

    Source

    M39 Analysis and Presentation of Cumulative Antimicrobial Susceptibility Test Data, 4th Edition, 2014, Clinical and Laboratory Standards Institute (CLSI). https://clsi.org/standards/products/microbiology/documents/m39/.

    +

    Value

    + +

    The function bug_drug_combinations returns a data.frame with columns "mo", "ab", "S", "I", "R" and "total".

    Details

    The function format calculates the resistance per bug-drug combination. Use combine_IR = FALSE (default) to test R vs. S+I and combine_IR = TRUE to test R+I vs. S.

    @@ -342,6 +344,7 @@
    diff --git a/docs/reference/index.html b/docs/reference/index.html index 49d9cd30..b7b7926a 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -84,7 +84,7 @@ AMR (for R) - 0.7.1.9098 + 0.7.1.9100
    diff --git a/docs/reference/mdro.html b/docs/reference/mdro.html index da7c8d9e..1eb1389a 100644 --- a/docs/reference/mdro.html +++ b/docs/reference/mdro.html @@ -85,7 +85,7 @@ AMR (for R) - 0.7.1.9097 + 0.7.1.9100 diff --git a/man/bug_drug_combinations.Rd b/man/bug_drug_combinations.Rd index 336c6d01..6913a452 100644 --- a/man/bug_drug_combinations.Rd +++ b/man/bug_drug_combinations.Rd @@ -8,8 +8,7 @@ \strong{M39 Analysis and Presentation of Cumulative Antimicrobial Susceptibility Test Data, 4th Edition}, 2014, \emph{Clinical and Laboratory Standards Institute (CLSI)}. \url{https://clsi.org/standards/products/microbiology/documents/m39/}. } \usage{ -bug_drug_combinations(x, col_mo = NULL, minimum = 30, - FUN = mo_shortname, ...) +bug_drug_combinations(x, col_mo = NULL, FUN = mo_shortname, ...) \method{format}{bug_drug_combinations}(x, translate_ab = "name (ab, atc)", language = get_locale(), @@ -23,8 +22,6 @@ bug_drug_combinations(x, col_mo = NULL, minimum = 30, \item{col_mo}{column name of the IDs of the microorganisms (see \code{\link{as.mo}}), defaults to the first column of class \code{mo}. Values will be coerced using \code{\link{as.mo}}.} -\item{minimum}{the minimum allowed number of available (tested) isolates. Any isolate count lower than \code{minimum} will return \code{NA} with a warning. The default number of \code{30} isolates is advised by the Clinical and Laboratory Standards Institute (CLSI) as best practice, see Source.} - \item{FUN}{the function to call on the \code{mo} column to transform the microorganism IDs, defaults to \code{\link{mo_shortname}}} \item{...}{arguments passed on to \code{FUN}} @@ -33,6 +30,8 @@ bug_drug_combinations(x, col_mo = NULL, minimum = 30, \item{language}{language of the returned text, defaults to system language (see \code{\link{get_locale}}) and can also be set with \code{\link{getOption}("AMR_locale")}. Use \code{language = NULL} or \code{language = ""} to prevent translation.} +\item{minimum}{the minimum allowed number of available (tested) isolates. Any isolate count lower than \code{minimum} will return \code{NA} with a warning. The default number of \code{30} isolates is advised by the Clinical and Laboratory Standards Institute (CLSI) as best practice, see Source.} + \item{combine_SI}{a logical to indicate whether all values of S and I must be merged into one, so the output only consists of S+I vs. R (susceptible vs. resistant). This used to be the parameter \code{combine_IR}, but this now follows the redefinition by EUCAST about the interpretion of I (increased exposure) in 2019, see section 'Interpretation of S, I and R' below. Default is \code{TRUE}.} \item{combine_IR}{logical to indicate whether values R and I should be summed} @@ -48,6 +47,9 @@ bug_drug_combinations(x, col_mo = NULL, minimum = 30, \code{big.interval} decimals \emph{before} (hence \code{big}) the decimal point.} } +\value{ +The function \code{bug_drug_combinations} returns a \code{data.frame} with columns "mo", "ab", "S", "I", "R" and "total". +} \description{ Determine antimicrobial resistance (AMR) of all bug-drug combinations in your data set where at least 30 (default) isolates are available per species. Use \code{format} on the result to prettify it to a publicable/printable format, see Examples. }