1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-26 17:26:12 +01:00

(v0.7.1.9066) bug-drug fix

This commit is contained in:
dr. M.S. (Matthijs) Berends 2019-08-27 23:00:00 +02:00
parent 248638ad91
commit e2b78fa428
12 changed files with 24 additions and 17 deletions

View File

@ -1,5 +1,5 @@
Package: AMR Package: AMR
Version: 0.7.1.9065 Version: 0.7.1.9066
Date: 2019-08-27 Date: 2019-08-27
Title: Antimicrobial Resistance Analysis Title: Antimicrobial Resistance Analysis
Authors@R: c( Authors@R: c(

View File

@ -1,4 +1,4 @@
# AMR 0.7.1.9065 # AMR 0.7.1.9066
### Breaking ### 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`: * 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`:

View File

@ -25,6 +25,7 @@
#' @inheritParams eucast_rules #' @inheritParams eucast_rules
#' @param combine_IR logical to indicate whether values R and I should be summed #' @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 #' @param add_ab_group logical to indicate where the group of the antimicrobials must be included as a first column
#' @param ... argumments passed on to \code{\link{mo_name}}
#' @inheritParams rsi_df #' @inheritParams rsi_df
#' @importFrom dplyr rename #' @importFrom dplyr rename
#' @importFrom tidyr spread #' @importFrom tidyr spread
@ -75,14 +76,14 @@ bug_drug_combinations <- function(x, col_mo = NULL, minimum = 30) {
#' @exportMethod format.bug_drug_combinations #' @exportMethod format.bug_drug_combinations
#' @export #' @export
#' @rdname bug_drug_combinations #' @rdname bug_drug_combinations
format.bug_drug_combinations <- function(x, combine_IR = FALSE, add_ab_group = TRUE) { format.bug_drug_combinations <- function(x, combine_IR = FALSE, add_ab_group = TRUE, ...) {
if (combine_IR == FALSE) { if (combine_IR == FALSE) {
x$isolates <- x$R x$isolates <- x$R
} else { } else {
x$isolates <- x$R + x$I x$isolates <- x$R + x$I
} }
y <- x %>% y <- x %>%
mutate(mo = mo_name(mo), mutate(mo = mo_name(mo, ...),
txt = paste0(percent(isolates / total, force_zero = TRUE), txt = paste0(percent(isolates / total, force_zero = TRUE),
" (", trimws(format(isolates, big.mark = ",")), "/", " (", trimws(format(isolates, big.mark = ",")), "/",
trimws(format(total, big.mark = ",")), ")")) %>% trimws(format(total, big.mark = ",")), ")")) %>%

View File

@ -78,7 +78,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9065</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9066</span>
</span> </span>
</div> </div>

View File

@ -78,7 +78,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9065</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9066</span>
</span> </span>
</div> </div>

View File

@ -78,7 +78,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9065</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9066</span>
</span> </span>
</div> </div>

View File

@ -42,7 +42,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9065</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9066</span>
</span> </span>
</div> </div>

View File

@ -78,7 +78,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9065</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9066</span>
</span> </span>
</div> </div>
@ -225,9 +225,9 @@
</div> </div>
<div id="amr-0-7-1-9065" class="section level1"> <div id="amr-0-7-1-9066" class="section level1">
<h1 class="page-header"> <h1 class="page-header">
<a href="#amr-0-7-1-9065" class="anchor"></a>AMR 0.7.1.9065<small> Unreleased </small> <a href="#amr-0-7-1-9066" class="anchor"></a>AMR 0.7.1.9066<small> Unreleased </small>
</h1> </h1>
<div id="breaking" class="section level3"> <div id="breaking" class="section level3">
<h3 class="hasAnchor"> <h3 class="hasAnchor">
@ -1258,7 +1258,7 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
<div id="tocnav"> <div id="tocnav">
<h2>Contents</h2> <h2>Contents</h2>
<ul class="nav nav-pills nav-stacked"> <ul class="nav nav-pills nav-stacked">
<li><a href="#amr-0-7-1-9065">0.7.1.9065</a></li> <li><a href="#amr-0-7-1-9066">0.7.1.9066</a></li>
<li><a href="#amr-0-7-1">0.7.1</a></li> <li><a href="#amr-0-7-1">0.7.1</a></li>
<li><a href="#amr-0-7-0">0.7.0</a></li> <li><a href="#amr-0-7-0">0.7.0</a></li>
<li><a href="#amr-0-6-1">0.6.1</a></li> <li><a href="#amr-0-6-1">0.6.1</a></li>

View File

@ -80,7 +80,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9065</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9066</span>
</span> </span>
</div> </div>
@ -238,7 +238,7 @@
<span class='co'># S3 method for bug_drug_combinations</span> <span class='co'># S3 method for bug_drug_combinations</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/format'>format</a></span>(<span class='no'>x</span>, <span class='kw'>combine_IR</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>, <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/format'>format</a></span>(<span class='no'>x</span>, <span class='kw'>combine_IR</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>,
<span class='kw'>add_ab_group</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)</pre> <span class='kw'>add_ab_group</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='no'>...</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2> <h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments"> <table class="ref-arguments">
@ -263,6 +263,10 @@
<th>add_ab_group</th> <th>add_ab_group</th>
<td><p>logical to indicate where the group of the antimicrobials must be included as a first column</p></td> <td><p>logical to indicate where the group of the antimicrobials must be included as a first column</p></td>
</tr> </tr>
<tr>
<th>...</th>
<td><p>argumments passed on to <code><a href='mo_property.html'>mo_name</a></code></p></td>
</tr>
</table> </table>
<h2 class="hasAnchor" id="source"><a class="anchor" href="#source"></a>Source</h2> <h2 class="hasAnchor" id="source"><a class="anchor" href="#source"></a>Source</h2>

View File

@ -78,7 +78,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9065</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9066</span>
</span> </span>
</div> </div>

View File

@ -11,7 +11,7 @@
bug_drug_combinations(x, col_mo = NULL, minimum = 30) bug_drug_combinations(x, col_mo = NULL, minimum = 30)
\method{format}{bug_drug_combinations}(x, combine_IR = FALSE, \method{format}{bug_drug_combinations}(x, combine_IR = FALSE,
add_ab_group = TRUE) add_ab_group = TRUE, ...)
} }
\arguments{ \arguments{
\item{x}{data with antibiotic columns, like e.g. \code{AMX} and \code{AMC}} \item{x}{data with antibiotic columns, like e.g. \code{AMX} and \code{AMC}}
@ -23,6 +23,8 @@ bug_drug_combinations(x, col_mo = NULL, minimum = 30)
\item{combine_IR}{logical to indicate whether values R and I should be summed} \item{combine_IR}{logical to indicate whether values R and I should be summed}
\item{add_ab_group}{logical to indicate where the group of the antimicrobials must be included as a first column} \item{add_ab_group}{logical to indicate where the group of the antimicrobials must be included as a first column}
\item{...}{argumments passed on to \code{\link{mo_name}}}
} }
\description{ \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 printable format, see Examples. 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.

View File

@ -23,7 +23,7 @@ context("bug_drug_combinations.R")
test_that("bug_drug_combinations works", { test_that("bug_drug_combinations works", {
b <- suppressWarnings(bug_drug_combinations(example_isolates)) b <- suppressWarnings(bug_drug_combinations(example_isolates))
expect_s3_class(b, "bugdrug") expect_s3_class(b, "bug_drug_combinations")
expect_message(print(b)) expect_message(print(b))
expect_true(is.data.frame(format(b))) expect_true(is.data.frame(format(b)))
}) })