diff --git a/DESCRIPTION b/DESCRIPTION index 618e56c4..727772bb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 1.0.0.9002 -Date: 2020-02-20 +Version: 1.0.0.9003 +Date: 2020-02-21 Title: Antimicrobial Resistance Analysis Authors@R: c( person(role = c("aut", "cre"), diff --git a/NEWS.md b/NEWS.md index 45e97681..1e17777c 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,8 +1,7 @@ -# AMR 1.0.0.9002 -## Last updated: 20-Feb-2020 +# AMR 1.0.0.9003 +## Last updated: 21-Feb-2020 ### Changed -* Added antibiotic abbreviations for a laboratory manufacturer (GLIMS) for cefuroxime, cefotaxime, ceftazidime, cefepime, cefoxitin and trimethoprim/sulfamethoxazole * Fixed floating point error for some MIC compa in EUCAST 2020 guideline * Interpretation from MIC values to R/SI can now be used with `mutate_at()` of the dplyr package: ```r @@ -12,6 +11,7 @@ yourdata %>% mutate_at(vars(antibiotic1:antibiotic25), as.rsi, mo = .$mybacteria) ``` +* Added antibiotic abbreviations for a laboratory manufacturer (GLIMS) for cefuroxime, cefotaxime, ceftazidime, cefepime, cefoxitin and trimethoprim/sulfamethoxazole * Added `uti` (as abbreviation of urinary tract infections) as parameter to `as.rsi()`, so interpretation of MIC values and disk zones can be made dependent on isolates specifically from UTIs # AMR 1.0.0 diff --git a/R/rsi.R b/R/rsi.R index 33d0aa4f..6e9894de 100755 --- a/R/rsi.R +++ b/R/rsi.R @@ -67,6 +67,8 @@ #' NIT = as.mic(32)) #' as.rsi(df) #' +#' \donttest{ +#' #' # the dplyr way #' library(dplyr) #' df %>% @@ -88,7 +90,8 @@ #' #' df %>% #' mutate_at(vars(AMP:NIT), as.rsi, mo = "E. coli", uti = TRUE) -#' +#' } +#' #' # for single values #' as.rsi(x = as.mic(2), #' mo = as.mo("S. pneumoniae"), @@ -199,20 +202,6 @@ as.rsi.default <- function(x, ...) { } } -#' @importFrom dplyr %>% -input_resembles_mic <- function(x) { - mic <- x %>% - gsub("[^0-9.,]+", "", .) %>% - unique() - mic_valid <- suppressWarnings(as.mic(mic)) - result <- sum(!is.na(mic_valid)) / length(mic) - if (is.na(result)) { - 0 - } else { - result - } -} - #' @rdname as.rsi #' @export as.rsi.mic <- function(x, mo, ab = deparse(substitute(x)), guideline = "EUCAST", uti = FALSE, ...) { @@ -402,10 +391,14 @@ get_guideline <- function(guideline) { rev() %>% .[1] } + if (!guideline_param %like% " ") { + # like 'EUCAST2020', should be 'EUCAST 2020' + guideline_param <- gsub("([a-z]+)([0-9]+)", "\\1 \\2", guideline_param, ignore.case = TRUE) + } if (!guideline_param %in% rsi_translation$guideline) { stop(paste0("invalid guideline: '", guideline, - "'.\nValid guidelines are: ", paste0("'", rev(sort(unique(rsi_translation$guideline))), "'", collapse = ", ")), + "'.\nValid guidelines are: ", paste0("'", unique(rsi_translation$guideline), "'", collapse = ", "), "."), call. = FALSE) } diff --git a/docs/404.html b/docs/404.html index 87b19b90..0b45f7dc 100644 --- a/docs/404.html +++ b/docs/404.html @@ -78,7 +78,7 @@
diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 5e578863..7ef89b7a 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -78,7 +78,7 @@ diff --git a/docs/articles/index.html b/docs/articles/index.html index 6cbfb963..a6853f39 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -78,7 +78,7 @@ diff --git a/docs/authors.html b/docs/authors.html index 45518727..1e94e3d9 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -78,7 +78,7 @@ diff --git a/docs/index.html b/docs/index.html index 54443350..cf3f6574 100644 --- a/docs/index.html +++ b/docs/index.html @@ -43,7 +43,7 @@ diff --git a/docs/news/index.html b/docs/news/index.html index e0ac389c..19ada721 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -78,7 +78,7 @@ @@ -219,19 +219,18 @@ -Added antibiotic abbreviations for a laboratory manufacturer (GLIMS) for cefuroxime, cefotaxime, ceftazidime, cefepime, cefoxitin and trimethoprim/sulfamethoxazole
Fixed floating point error for some MIC compa in EUCAST 2020 guideline
Interpretation from MIC values to R/SI can now be used with mutate_at()
of the dplyr package:
Added antibiotic abbreviations for a laboratory manufacturer (GLIMS) for cefuroxime, cefotaxime, ceftazidime, cefepime, cefoxitin and trimethoprim/sulfamethoxazole
Added uti
(as abbreviation of urinary tract infections) as parameter to as.rsi()
, so interpretation of MIC values and disk zones can be made dependent on isolates specifically from UTIs