diff --git a/DESCRIPTION b/DESCRIPTION index a98bd5c5..d23fe9cd 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: AMR -Version: 0.7.1.9064 +Version: 0.7.1.9065 Date: 2019-08-27 Title: Antimicrobial Resistance Analysis Authors@R: c( diff --git a/NAMESPACE b/NAMESPACE index ec5bab9e..2be34a53 100755 --- a/NAMESPACE +++ b/NAMESPACE @@ -23,7 +23,7 @@ S3method(c,ab) S3method(c,mo) S3method(droplevels,mic) S3method(droplevels,rsi) -S3method(format,bugdrug) +S3method(format,bug_drug_combinations) S3method(freq,mo) S3method(freq,rsi) S3method(kurtosis,data.frame) @@ -38,7 +38,7 @@ S3method(plot,mic) S3method(plot,resistance_predict) S3method(plot,rsi) S3method(print,ab) -S3method(print,bugdrug) +S3method(print,bug_drug_combinations) S3method(print,catalogue_of_life_version) S3method(print,disk) S3method(print,mic) @@ -201,7 +201,7 @@ exportMethods(c.ab) exportMethods(c.mo) exportMethods(droplevels.mic) exportMethods(droplevels.rsi) -exportMethods(format.bugdrug) +exportMethods(format.bug_drug_combinations) exportMethods(freq.mo) exportMethods(freq.rsi) exportMethods(kurtosis) @@ -211,7 +211,7 @@ exportMethods(kurtosis.matrix) exportMethods(plot.mic) exportMethods(plot.rsi) exportMethods(print.ab) -exportMethods(print.bugdrug) +exportMethods(print.bug_drug_combinations) exportMethods(print.catalogue_of_life_version) exportMethods(print.disk) exportMethods(print.mic) diff --git a/NEWS.md b/NEWS.md index 46346e50..3fc61873 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 0.7.1.9064 +# AMR 0.7.1.9065 ### 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`: diff --git a/R/bug_drug_combinations.R b/R/bug_drug_combinations.R index 120ddcfb..bf3ff3d1 100644 --- a/R/bug_drug_combinations.R +++ b/R/bug_drug_combinations.R @@ -24,12 +24,14 @@ #' 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 #' @param combine_IR logical to indicate whether values R and I should be summed +#' @param add_ab_group logical to indicate where the group of the antimicrobials must be included as a first column #' @inheritParams rsi_df #' @importFrom dplyr rename #' @importFrom tidyr spread #' @importFrom clean freq -#' @details The function \code{format} calculated the resistance per bug-drug combination. Use \code{combine_IR = FALSE} (default) to test R vs. S+I and \code{combine_IR = TRUE} to test R+I vs. S. +#' @details The function \code{format} calculates the resistance per bug-drug combination. Use \code{combine_IR = FALSE} (default) to test R vs. S+I and \code{combine_IR = TRUE} to test R+I vs. S. #' @export +#' @rdname bug_drug_combinations #' @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 @@ -65,14 +67,15 @@ bug_drug_combinations <- function(x, col_mo = NULL, minimum = 30) { filter(total >= minimum) %>% rename(ab = antibiotic) - structure(.Data = x, class = c("bugdrug", class(x))) + structure(.Data = x, class = c("bug_drug_combinations", class(x))) } #' @importFrom dplyr everything rename #' @importFrom tidyr spread -#' @exportMethod format.bugdrug +#' @exportMethod format.bug_drug_combinations #' @export -format.bugdrug <- function(x, combine_IR = FALSE, add_ab_group = TRUE, ...) { +#' @rdname bug_drug_combinations +format.bug_drug_combinations <- function(x, combine_IR = FALSE, add_ab_group = TRUE) { if (combine_IR == FALSE) { x$isolates <- x$R } else { @@ -100,10 +103,10 @@ format.bugdrug <- function(x, combine_IR = FALSE, add_ab_group = TRUE, ...) { y } -#' @exportMethod print.bugdrug +#' @exportMethod print.bug_drug_combinations #' @export #' @importFrom crayon blue -print.bugdrug <- function(x, ...) { +print.bug_drug_combinations <- 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/first_isolate.R b/R/first_isolate.R index 821d9f72..a49bb844 100755 --- a/R/first_isolate.R +++ b/R/first_isolate.R @@ -25,7 +25,7 @@ #' @param x a \code{data.frame} containing isolates. #' @param col_date column name of the result date (or date that is was received on the lab), defaults to the first column of with a date class #' @param col_patient_id column name of the unique IDs of the patients, defaults to the first column that starts with 'patient' or 'patid' (case insensitive) -#' @param col_mo column name of the unique IDs of the microorganisms (see \code{\link{mo}}), defaults to the first column of class \code{mo}. Values will be coerced using \code{\link{as.mo}}. +#' @param 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}}. #' @param col_testcode column name of the test codes. Use \code{col_testcode = NULL} to \strong{not} exclude certain test codes (like test codes for screening). In that case \code{testcodes_exclude} will be ignored. #' @param col_specimen column name of the specimen type or group #' @param col_icu column name of the logicals (\code{TRUE}/\code{FALSE}) whether a ward or department is an Intensive Care Unit (ICU) diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 34e1b6df..70932de4 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.1.9064 + 0.7.1.9065 diff --git a/docs/articles/index.html b/docs/articles/index.html index 40c9b2f4..5ead41b0 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.1.9064 + 0.7.1.9065 diff --git a/docs/authors.html b/docs/authors.html index c9f93bae..48329d08 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.1.9064 + 0.7.1.9065 diff --git a/docs/index.html b/docs/index.html index 545233f8..4166c1a2 100644 --- a/docs/index.html +++ b/docs/index.html @@ -42,7 +42,7 @@ AMR (for R) - 0.7.1.9064 + 0.7.1.9065 diff --git a/docs/news/index.html b/docs/news/index.html index 615896bf..59f217d0 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.1.9064 + 0.7.1.9065 @@ -225,9 +225,9 @@ -
+

-AMR 0.7.1.9064 Unreleased +AMR 0.7.1.9065 Unreleased

@@ -1258,7 +1258,7 @@ Using as.mo(..., allow_uncertain = 3)

Contents

@@ -275,7 +275,7 @@ col_mo -

column name of the unique IDs of the microorganisms (see mo), defaults to the first column of class mo. Values will be coerced using as.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.

threshold diff --git a/docs/reference/bug_drug_combinations.html b/docs/reference/bug_drug_combinations.html index d5b02a3a..160f18ea 100644 --- a/docs/reference/bug_drug_combinations.html +++ b/docs/reference/bug_drug_combinations.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.1.9064 + 0.7.1.9065
@@ -234,7 +234,11 @@
-
bug_drug_combinations(x, col_mo = NULL, minimum = 30)
+
bug_drug_combinations(x, col_mo = NULL, minimum = 30)
+
+# S3 method for bug_drug_combinations
+format(x, combine_IR = FALSE,
+  add_ab_group = TRUE)

Arguments

@@ -245,7 +249,7 @@ - + @@ -255,6 +259,10 @@ + + + +
col_mo

column name of the unique IDs of the microorganisms (see mo), defaults to the first column of class mo. Values will be coerced using as.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.

minimumcombine_IR

logical to indicate whether values R and I should be summed

add_ab_group

logical to indicate where the group of the antimicrobials must be included as a first column

Source

@@ -263,7 +271,7 @@

Details

-

The function format calculated 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.

+

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.

Read more on our website!

diff --git a/docs/reference/eucast_rules.html b/docs/reference/eucast_rules.html index d9024478..9ea4dff0 100644 --- a/docs/reference/eucast_rules.html +++ b/docs/reference/eucast_rules.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.1.9055 + 0.7.1.9065 @@ -246,7 +246,7 @@ col_mo -

column name of the unique IDs of the microorganisms (see mo), defaults to the first column of class mo. Values will be coerced using as.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.

info @@ -438,7 +438,7 @@