diff --git a/DESCRIPTION b/DESCRIPTION index 08eff9b3..2c44bec9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 0.7.1.9058 -Date: 2019-08-20 +Version: 0.7.1.9059 +Date: 2019-08-25 Title: Antimicrobial Resistance Analysis Authors@R: c( person(role = c("aut", "cre"), @@ -30,7 +30,7 @@ Depends: R (>= 3.1.0) Imports: backports, - clean, + clean (>= 1.1.0), crayon (>= 1.3.0), data.table (>= 1.9.0), dplyr (>= 0.7.0), diff --git a/NAMESPACE b/NAMESPACE index 69aa40ef..ec5bab9e 100755 --- a/NAMESPACE +++ b/NAMESPACE @@ -23,6 +23,7 @@ S3method(c,ab) S3method(c,mo) S3method(droplevels,mic) S3method(droplevels,rsi) +S3method(format,bugdrug) S3method(freq,mo) S3method(freq,rsi) S3method(kurtosis,data.frame) @@ -37,6 +38,7 @@ S3method(plot,mic) S3method(plot,resistance_predict) S3method(plot,rsi) S3method(print,ab) +S3method(print,bugdrug) S3method(print,catalogue_of_life_version) S3method(print,disk) S3method(print,mic) @@ -81,6 +83,7 @@ export(atc_online_groups) export(atc_online_property) export(availability) export(brmo) +export(bug_drug_combinations) export(catalogue_of_life_version) export(count_I) export(count_IR) @@ -108,6 +111,7 @@ export(filter_glycopeptides) export(filter_macrolides) export(filter_tetracyclines) export(first_isolate) +export(freq) export(full_join_microorganisms) export(g.test) export(geom_rsi) @@ -197,6 +201,7 @@ exportMethods(c.ab) exportMethods(c.mo) exportMethods(droplevels.mic) exportMethods(droplevels.rsi) +exportMethods(format.bugdrug) exportMethods(freq.mo) exportMethods(freq.rsi) exportMethods(kurtosis) @@ -206,6 +211,7 @@ exportMethods(kurtosis.matrix) exportMethods(plot.mic) exportMethods(plot.rsi) exportMethods(print.ab) +exportMethods(print.bugdrug) exportMethods(print.catalogue_of_life_version) exportMethods(print.disk) exportMethods(print.mic) @@ -223,6 +229,7 @@ exportMethods(summary.mic) exportMethods(summary.mo) exportMethods(summary.rsi) importFrom(clean,freq) +importFrom(clean,freq.default) importFrom(clean,top_freq) importFrom(crayon,bgGreen) importFrom(crayon,bgRed) @@ -272,6 +279,7 @@ importFrom(dplyr,n_distinct) importFrom(dplyr,n_groups) importFrom(dplyr,progress_estimated) importFrom(dplyr,pull) +importFrom(dplyr,rename) importFrom(dplyr,row_number) importFrom(dplyr,select) importFrom(dplyr,select_if) @@ -300,6 +308,8 @@ importFrom(stats,glm) importFrom(stats,lm) importFrom(stats,pchisq) importFrom(stats,predict) +importFrom(tidyr,gather) +importFrom(tidyr,spread) importFrom(utils,browseURL) importFrom(utils,installed.packages) importFrom(utils,menu) diff --git a/NEWS.md b/NEWS.md index 7ffdb24a..37cb658c 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,7 +1,7 @@ -# AMR 0.7.1.9058 +# AMR 0.7.1.9059 ### Breaking -* Function `freq()` has moved to a new package, [`clean`](https://github.com/msberends/clean) ([CRAN link](https://cran.r-project.org/package=clean)). Creating frequency tables is actually not the scope of this package (never was) and this function has matured a lot over the last two years. Therefore, a new package was created for data cleaning and checking and it perfectly fits the `freq()` function. The [`clean`](https://github.com/msberends/clean) package is available on CRAN and will be installed automatically when updating the `AMR` package, that now imports it. In a later stage, the `skewness()` and `kurtosis()` functions will be moved to the `clean` package too. +* Function `freq()` has moved to a new package, [`clean`](https://github.com/msberends/clean) ([CRAN link](https://cran.r-project.org/package=clean)). The `freq()` function still works, since it is re-exported from the `clean` package to this `AMR` package. Creating frequency tables is actually not the scope of this package (never was) and this function has matured a lot over the last two years. Therefore, a new package was created for data cleaning and checking and it perfectly fits the `freq()` function. The [`clean`](https://github.com/msberends/clean) package is available on CRAN and will be installed automatically when updating the `AMR` package, that now imports it. In a later stage, the `skewness()` and `kurtosis()` functions will be moved to the `clean` package too. * 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`: ```r first_isolate(..., include_unknown = TRUE) @@ -9,6 +9,21 @@ For WHONET users, this means that all records with organism code `"con"` (*contamination*) will be excluded at default, since `as.mo("con") = "UNKNOWN"`. The function always shows a note with the number of 'unknown' microorganisms that were included or excluded. ### New +* Function `bug_drug_combinations()` to quickly get a `data.frame` with the antimicrobial resistance of any bug-drug combination in a data set: + ```r + x <- bug_drug_combinations(septic_patients) + x + #> ab mo S I R total + #> 1 AMC B_ESCHR_COL 332 74 61 467 + #> 2 AMC B_KLBSL_PNE 49 3 6 58 + #> 3 AMC B_PROTS_MIR 28 7 1 36 + #> 4 AMC B_PSDMN_AER 0 0 30 30 + #> 5 AMC B_STPHY_AUR 234 0 1 235 + ``` + You can format this to a printable format, ready for reporting or exporting to e.g. Excel with the base R `format()` function: + ```r + format(x) + ``` * Additional way to calculate co-resistance, i.e. when using multiple antibiotics as input for `portion_*` functions or `count_*` functions. This can be used to determine the empiric susceptibily of a combination therapy. A new parameter `only_all_tested` (**which defaults to `FALSE`**) replaces the old `also_single_tested` and can be used to select one of the two methods to count isolates and calculate portions. The difference can be seen in this example table (which is also on the `portion` and `count` help pages), where the %SI is being determined: ```r @@ -72,6 +87,7 @@ * Speed improvement for `guess_ab_col()` which is now 30 times faster for antibiotic abbreviations * Improved `filter_ab_class()` to be more reliable and to support 5th generation cephalosporins * Classes `ab` and `mo` will now be preserved in any subsetting +* Function `availability()` now uses `portion_R()` instead of `portion_IR()`, to comply with EUCAST insights #### Other * Added Prof Dr Casper Albers as doctoral advisor and Dr Bart Meijer, Dr Dennis Souverein and Annick Lenglet as contributors diff --git a/R/availability.R b/R/availability.R index cec00f1e..e6e1bf43 100644 --- a/R/availability.R +++ b/R/availability.R @@ -21,9 +21,10 @@ #' Check availability of columns #' -#' Easy check for availability of columns in a data set. This makes it easy to get an idea of which antibiotic combination can be used for calculation with e.g. \code{\link{portion_IR}}. +#' Easy check for availability of columns in a data set. This makes it easy to get an idea of which antimicrobial combination can be used for calculation with e.g. \code{\link{portion_R}}. #' @param tbl a \code{data.frame} or \code{list} #' @param width number of characters to present the visual availability, defaults to filling the width of the console +#' @details The function returns a \code{data.frame} with columns \code{"resistant"} and \code{"visual_resistance"}. The values in that columns are calculated with \code{\link{portion_R}}. #' @return \code{data.frame} with column names of \code{tbl} as row names #' @inheritSection AMR Read more on our website! #' @export @@ -44,10 +45,10 @@ availability <- function(tbl, width = NULL) { x <- base::sapply(tbl, function(x) { 1 - base::sum(base::is.na(x)) / base::length(x) }) n <- base::sapply(tbl, function(x) base::length(x[!base::is.na(x)])) - IR <- base::sapply(tbl, function(x) base::ifelse(is.rsi(x), portion_IR(x, minimum = 0), NA)) - IR_print <- character(length(IR)) - IR_print[!is.na(IR)] <- percent(IR[!is.na(IR)], round = 1, force_zero = TRUE) - IR_print[is.na(IR)] <- "" + R <- base::sapply(tbl, function(x) base::ifelse(is.rsi(x), portion_R(x, minimum = 0), NA)) + R_print <- character(length(R)) + R_print[!is.na(R)] <- percent(R[!is.na(R)], round = 1, force_zero = TRUE) + R_print[is.na(R)] <- "" if (is.null(width)) { width <- options()$width - @@ -63,14 +64,14 @@ availability <- function(tbl, width = NULL) { width <- width / 2 } - if (length(IR[is.na(IR)]) == ncol(tbl)) { + if (length(R[is.na(R)]) == ncol(tbl)) { width <- width * 2 + 10 } - x_chars_IR <- strrep("#", round(width * IR, digits = 2)) - x_chars_S <- strrep("-", width - nchar(x_chars_IR)) - vis_resistance <- paste0("|", x_chars_IR, x_chars_S, "|") - vis_resistance[is.na(IR)] <- "" + x_chars_R <- strrep("#", round(width * R, digits = 2)) + x_chars_SI <- strrep("-", width - nchar(x_chars_R)) + vis_resistance <- paste0("|", x_chars_R, x_chars_SI, "|") + vis_resistance[is.na(R)] <- "" x_chars <- strrep("#", round(x, digits = 2) / (1 / width)) x_chars_empty <- strrep("-", width - nchar(x_chars)) @@ -78,9 +79,9 @@ availability <- function(tbl, width = NULL) { df <- data.frame(count = n, available = percent(x, round = 1, force_zero = TRUE), visual_availabilty = paste0("|", x_chars, x_chars_empty, "|"), - resistant = IR_print, + resistant = R_print, visual_resistance = vis_resistance) - if (length(IR[is.na(IR)]) == ncol(tbl)) { + if (length(R[is.na(R)]) == ncol(tbl)) { df[,1:3] } else { df diff --git a/R/bug_drug_combinations.R b/R/bug_drug_combinations.R new file mode 100644 index 00000000..8f418abf --- /dev/null +++ b/R/bug_drug_combinations.R @@ -0,0 +1,107 @@ +# ==================================================================== # +# TITLE # +# Antimicrobial Resistance (AMR) Analysis # +# # +# SOURCE # +# https://gitlab.com/msberends/AMR # +# # +# LICENCE # +# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) # +# # +# 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. # +# # +# This R package was created for academic research and was publicly # +# released in the hope that it will be useful, but it comes WITHOUT # +# ANY WARRANTY OR LIABILITY. # +# Visit our website for more info: https://msberends.gitlab.io/AMR. # +# ==================================================================== # + +#' Determine bug-drug combinations +#' +#' 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 printable format, see Examples. +#' @inheritParams eucast_rules +#' @inheritParams rsi_df +#' @importFrom dplyr rename +#' @importFrom tidyr spread +#' @importFrom clean freq +#' @export +#' @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 +#' \donttest{ +#' x <- bug_drug_combinations(septic_patients) +#' x +#' format(x) +#' } +bug_drug_combinations <- function(x, col_mo = NULL, minimum = 30) { + if (!is.data.frame(x)) { + stop("`x` must be a data frame.", call. = FALSE) + } + + # try to find columns based on type + # -- mo + if (is.null(col_mo)) { + col_mo <- search_type_in_df(x = x, type = "mo") + } + if (is.null(col_mo)) { + stop("`col_mo` must be set.", call. = FALSE) + } + + x <- x %>% + mutate(col_mo = x %>% pull(col_mo)) %>% + filter(mo %in% (clean::freq(mo) %>% + filter(count >= minimum) %>% + pull(item))) %>% + group_by(mo) %>% + AMR::rsi_df(translate_ab = FALSE, combine_SI = FALSE) %>% + select(-value) %>% + spread(interpretation, isolates) %>% + mutate(total = S + I + R) %>% + filter(total >= minimum) %>% + rename(ab = antibiotic) + + structure(.Data = x, class = c("bugdrug", class(x))) +} + +#' @importFrom dplyr everything rename +#' @importFrom tidyr spread +#' @exportMethod format.bugdrug +#' @export +format.bugdrug <- function(x, combine_SI = TRUE, add_ab_group = TRUE, ...) { + if (combine_SI == TRUE) { + x$isolates <- x$R + } else { + x$isolates <- x$R + x$I + } + y <- x %>% + mutate(mo = mo_name(mo), + txt = paste0(AMR:::percent(isolates / total, force_zero = TRUE), + " (", trimws(format(isolates, big.mark = ",")), "/", + trimws(format(total, big.mark = ",")), ")")) %>% + select(ab, mo, txt) %>% + spread(mo, txt) %>% + mutate_all(~ifelse(is.na(.), "", .)) %>% + mutate(ab = paste0(ab_name(ab), " (", as.ab(ab), ", ", ab_atc(ab), ")"), + ab_group = ab_group(ab)) %>% + select(ab_group, ab, everything()) %>% + arrange(ab_group, ab) %>% + mutate(ab_group = ifelse(ab_group != lag(ab_group) | is.na(lag(ab_group)), ab_group, "")) + + if (add_ab_group == FALSE) { + y <- y %>% select(-ab_group) + } + y <- y %>% rename("Group" = ab_group, + "Antibiotic" = ab) + y +} + +#' @exportMethod print.bugdrug +#' @export +#' @importFrom crayon blue +print.bugdrug <- function(x, ...) { + print(as.data.frame(x, stringsAsFactors = FALSE)) + message(blue("NOTE: Use 'format()' on this result to get a format that is ready for export or printing.")) +} diff --git a/R/freq.R b/R/freq.R index 38ff3880..104dc639 100755 --- a/R/freq.R +++ b/R/freq.R @@ -19,23 +19,25 @@ # Visit our website for more info: https://msberends.gitlab.io/AMR. # # ==================================================================== # -freq_def <- clean:::freq.default +#' @importFrom clean freq +#' @export +clean::freq + #' @exportMethod freq.mo #' @importFrom dplyr n_distinct -#' @importFrom clean freq +#' @importFrom clean freq.default #' @export #' @noRd freq.mo <- function(x, ...) { - # replace with freq.default() if next `clean` version is published on CRAN - freq_def(x = x, ..., - .add_header = list(families = n_distinct(mo_family(x, language = NULL)), - genera = n_distinct(mo_genus(x, language = NULL)), - species = n_distinct(paste(mo_genus(x, language = NULL), - mo_species(x, language = NULL))))) + freq.default(x = x, ..., + .add_header = list(families = n_distinct(mo_family(x, language = NULL)), + genera = n_distinct(mo_genus(x, language = NULL)), + species = n_distinct(paste(mo_genus(x, language = NULL), + mo_species(x, language = NULL))))) } #' @exportMethod freq.rsi -#' @importFrom clean freq +#' @importFrom clean freq.default #' @export #' @noRd freq.rsi <- function(x, ...) { @@ -43,12 +45,12 @@ freq.rsi <- function(x, ...) { x_name <- gsub(".*[$]", "", x_name) ab <- suppressMessages(suppressWarnings(AMR::as.ab(x_name))) if (!is.na(ab)) { - freq_def(x = x, ..., - .add_header = list(Drug = paste0(ab_name(ab), " (", ab, ", ", ab_atc(ab), ")"), - group = ab_group(ab), - `%SI` = portion_SI(x, minimum = 0, as_percent = TRUE))) + freq.default(x = x, ..., + .add_header = list(Drug = paste0(ab_name(ab), " (", ab, ", ", ab_atc(ab), ")"), + group = ab_group(ab), + `%SI` = AMR::portion_SI(x, minimum = 0, as_percent = TRUE))) } else { - freq_def(x = x, ..., - .add_header = list(`%SI` = portion_SI(x, minimum = 0, as_percent = TRUE))) + freq.default(x = x, ..., + .add_header = list(`%SI` = AMR::portion_SI(x, minimum = 0, as_percent = TRUE))) } } diff --git a/R/rsi_calc.R b/R/rsi_calc.R index e1617fb0..fdc08965 100755 --- a/R/rsi_calc.R +++ b/R/rsi_calc.R @@ -169,6 +169,7 @@ rsi_calc <- function(..., } #' @importFrom dplyr %>% summarise_if mutate select everything bind_rows +#' @importFrom tidyr gather rsi_calc_df <- function(type, # "portion" or "count" data, translate_ab = "name", @@ -187,10 +188,10 @@ rsi_calc_df <- function(type, # "portion" or "count" combine_SI <- FALSE } if (isTRUE(combine_SI) & isTRUE(combine_IR)) { - stop("either `combine_SI` or `combine_IR` can be TRUE", call. = FALSE) + stop("either `combine_SI` or `combine_IR` can be TRUE, not both", call. = FALSE) } - if (data %>% select_if(is.rsi) %>% ncol() == 0) { + if (!any(sapply(data, is.rsi), na.rm = TRUE)) { stop("No columns with class 'rsi' found. See ?as.rsi.", call. = FALSE) } @@ -198,7 +199,7 @@ rsi_calc_df <- function(type, # "portion" or "count" translate_ab <- "name" } - get_summaryfunction <- function(int) { + get_summaryfunction <- function(int, type) { # look for portion_S, count_S, etc: int_fn <- get(paste0(type, "_", int), envir = asNamespace("AMR")) @@ -218,11 +219,11 @@ rsi_calc_df <- function(type, # "portion" or "count" select(interpretation, everything()) } - resS <- get_summaryfunction("S") - resI <- get_summaryfunction("I") - resR <- get_summaryfunction("R") - resSI <- get_summaryfunction("SI") - resIR <- get_summaryfunction("IR") + resS <- get_summaryfunction("S", type) + resI <- get_summaryfunction("I", type) + resR <- get_summaryfunction("R", type) + resSI <- get_summaryfunction("SI", type) + resIR <- get_summaryfunction("IR", type) data.groups <- group_vars(data) if (isFALSE(combine_SI) & isFALSE(combine_IR)) { @@ -245,11 +246,11 @@ rsi_calc_df <- function(type, # "portion" or "count" } res <- res %>% - tidyr::gather(antibiotic, value, -interpretation, -data.groups) %>% + gather(antibiotic, value, -interpretation, -data.groups) %>% select(antibiotic, everything()) if (!translate_ab == FALSE) { - res <- res %>% mutate(antibiotic = ab_property(antibiotic, property = translate_ab, language = language)) + res <- res %>% mutate(antibiotic = AMR::ab_property(antibiotic, property = translate_ab, language = language)) } res diff --git a/R/rsi_df.R b/R/rsi_df.R index 84cc46ff..11520b0f 100644 --- a/R/rsi_df.R +++ b/R/rsi_df.R @@ -21,7 +21,6 @@ #' @rdname portion #' @rdname count -#' @importFrom dplyr %>% select_if bind_rows summarise_if mutate group_vars select everything #' @export rsi_df <- function(data, translate_ab = "name", diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 2d2fe6c5..29e2d2e4 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.1.9058 + 0.7.1.9059 diff --git a/docs/articles/index.html b/docs/articles/index.html index 0ab00eda..e7e76955 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.1.9058 + 0.7.1.9059 diff --git a/docs/authors.html b/docs/authors.html index 1b328999..d9f466d5 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.1.9058 + 0.7.1.9059 diff --git a/docs/index.html b/docs/index.html index b3fd9b29..71ab45f1 100644 --- a/docs/index.html +++ b/docs/index.html @@ -42,7 +42,7 @@ AMR (for R) - 0.7.1.9058 + 0.7.1.9059 diff --git a/docs/news/index.html b/docs/news/index.html index 2cb5c0b6..8014e475 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.1.9058 + 0.7.1.9059 @@ -225,15 +225,15 @@ -
+

-AMR 0.7.1.9058 Unreleased +AMR 0.7.1.9059 Unreleased

Breaking

@@ -339,14 +353,14 @@

All these lead to the microbial ID of E. coli:

- +
  • Function mo_info() as an analogy to ab_info(). The mo_info() prints a list with the full taxonomy, authors, and the URL to the online database of a microorganism
  • Function mo_synonyms() to get all previously accepted taxonomic names of a microorganism

  • @@ -461,21 +475,21 @@ Please age() function gained a new parameter exact to determine ages with decimals
  • Removed deprecated functions guess_mo(), guess_atc(), EUCAST_rules(), interpretive_reading(), rsi()
  • -
  • Frequency tables (freq()): +
  • Frequency tables (freq()):
  • @@ -485,7 +499,7 @@ Please age_groups(), to let groups of fives and tens end with 100+ instead of 120+ -
  • Fix for freq() for when all values are NA +
  • Fix for freq() for when all values are NA
  • Fix for first_isolate() for when dates are missing
  • Improved speed of guess_ab_col() @@ -560,32 +574,32 @@ This data is updated annually - check the included version with the new function
  • New filters for antimicrobial classes. Use these functions to filter isolates on results in one of more antibiotics from a specific class:

    - +

    The antibiotics data set will be searched, after which the input data will be checked for column names with a value in any abbreviations, codes or official names found in the antibiotics data set. For example:

    - +
  • All ab_* functions are deprecated and replaced by atc_* functions:

    - + These functions use as.atc() internally. The old atc_property has been renamed atc_online_property(). This is done for two reasons: firstly, not all ATC codes are of antibiotics (ab) but can also be of antivirals or antifungals. Secondly, the input must have class atc or must be coerable to this class. Properties of these classes should start with the same class name, analogous to as.mo() and e.g. mo_genus.
  • New functions set_mo_source() and get_mo_source() to use your own predefined MO codes as input for as.mo() and consequently all mo_* functions
  • Support for the upcoming dplyr version 0.8.0
  • @@ -597,20 +611,20 @@ These functions use as.atc()New function age_groups() to split ages into custom or predefined groups (like children or elderly). This allows for easier demographic antimicrobial resistance analysis per age group.
  • New function ggplot_rsi_predict() as well as the base R plot() function can now be used for resistance prediction calculated with resistance_predict():

    -
    x <- resistance_predict(septic_patients, col_ab = "amox")
    -plot(x)
    -ggplot_rsi_predict(x)
    +
    x <- resistance_predict(septic_patients, col_ab = "amox")
    +plot(x)
    +ggplot_rsi_predict(x)
  • Functions filter_first_isolate() and filter_first_weighted_isolate() to shorten and fasten filtering on data sets with antimicrobial results, e.g.:

    - +

    is equal to:

    -
    septic_patients %>%
    -  mutate(only_firsts = first_isolate(septic_patients, ...)) %>%
    -  filter(only_firsts == TRUE) %>%
    -  select(-only_firsts)
    +
    septic_patients %>%
    +  mutate(only_firsts = first_isolate(septic_patients, ...)) %>%
    +  filter(only_firsts == TRUE) %>%
    +  select(-only_firsts)
  • New function availability() to check the number of available (non-empty) results in a data.frame
  • @@ -639,33 +653,33 @@ These functions use as.atc()
  • Now handles incorrect spelling, like i instead of y and f instead of ph:

    - +
  • Uncertainty of the algorithm is now divided into four levels, 0 to 3, where the default allow_uncertain = TRUE is equal to uncertainty level 2. Run ?as.mo for more info about these levels.

    -
    # equal:
    -as.mo(..., allow_uncertain = TRUE)
    -as.mo(..., allow_uncertain = 2)
    -
    -# also equal:
    -as.mo(..., allow_uncertain = FALSE)
    -as.mo(..., allow_uncertain = 0)
    +
    # equal:
    +as.mo(..., allow_uncertain = TRUE)
    +as.mo(..., allow_uncertain = 2)
    +
    +# also equal:
    +as.mo(..., allow_uncertain = FALSE)
    +as.mo(..., allow_uncertain = 0)
    Using as.mo(..., allow_uncertain = 3) could lead to very unreliable results.
  • Implemented the latest publication of Becker et al. (2019), for categorising coagulase-negative Staphylococci
  • All microbial IDs that found are now saved to a local file ~/.Rhistory_mo. Use the new function clean_mo_history() to delete this file, which resets the algorithms.
  • Incoercible results will now be considered ‘unknown’, MO code UNKNOWN. On foreign systems, properties of these will be translated to all languages already previously supported: German, Dutch, French, Italian, Spanish and Portuguese:

    - +
  • Fix for vector containing only empty values
  • Finds better results when input is in other languages
  • @@ -707,23 +721,23 @@ Using as.mo(..., allow_uncertain = 3) -
  • Frequency tables (freq() function): +
  • Frequency tables (freq() function):
  • @@ -1078,13 +1092,13 @@ Using as.mo(..., allow_uncertain = 3)
  • A vignette to explain its usage
  • Support for rsi (antimicrobial resistance) to use as input
  • -
  • Support for table to use as input: freq(table(x, y)) +
  • Support for table to use as input: freq(table(x, y))
  • Support for existing functions hist and plot to use a frequency table as input: hist(freq(df$age))
  • Support for as.vector, as.data.frame, as_tibble and format
  • -
  • Support for quasiquotation: freq(mydata, mycolumn) is the same as mydata %>% freq(mycolumn) +
  • Support for quasiquotation: freq(mydata, mycolumn) is the same as mydata %>% freq(mycolumn)
  • Function top_freq function to return the top/below n items as vector
  • Header of frequency tables now also show Mean Absolute Deviaton (MAD) and Interquartile Range (IQR)
  • @@ -1238,7 +1252,7 @@ Using as.mo(..., allow_uncertain = 3)

    Contents

    @@ -230,7 +230,7 @@
    -

    Easy check for availability of columns in a data set. This makes it easy to get an idea of which antibiotic combination can be used for calculation with e.g. portion_IR.

    +

    Easy check for availability of columns in a data set. This makes it easy to get an idea of which antimicrobial combination can be used for calculation with e.g. portion_R.

    @@ -253,6 +253,10 @@

    data.frame with column names of tbl as row names

    +

    Details

    + +

    The function returns a data.frame with columns "resistant" and "visual_resistance". The values in that columns are calculated with portion_R.

    +

    Read more on our website!

    @@ -283,6 +287,8 @@
  • Value
  • +
  • Details
  • +
  • Read more on our website!
  • Examples
  • @@ -293,7 +299,7 @@