1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-25 18:46:11 +01:00

(v1.4.0.9004) bugfix

This commit is contained in:
dr. M.S. (Matthijs) Berends 2020-10-21 11:50:43 +02:00
parent 2ef7dfc8a3
commit ade9f8bafd
15 changed files with 32 additions and 32 deletions

View File

@ -1,6 +1,6 @@
Package: AMR
Version: 1.4.0.9003
Date: 2020-10-20
Version: 1.4.0.9004
Date: 2020-10-21
Title: Antimicrobial Resistance Analysis
Authors@R: c(
person(role = c("aut", "cre"),

View File

@ -1,5 +1,5 @@
# AMR 1.4.0.9003
## <small>Last updated: 20 October 2020</small>
# AMR 1.4.0.9004
## <small>Last updated: 21 October 2020</small>
### New
* Functions `is_gram_negative()` and `is_gram_positive()` as wrappers around `mo_gramstain()`. They always return `TRUE` or `FALSE`, thus always return `FALSE` for species outside the taxonomic kingdom of Bacteria.

View File

@ -273,7 +273,7 @@ geom_rsi <- function(position = NULL,
combine_SI = TRUE,
combine_IR = FALSE,
...) {
x <- x[1]
stop_ifnot_installed("ggplot2")
stop_if(is.data.frame(position), "`position` is invalid. Did you accidentally use '%>%' instead of '+'?")
meet_criteria(position, allow_class = "character", has_length = 1, is_in = c("fill", "stack", "dodge"), allow_NULL = TRUE)
@ -294,8 +294,6 @@ geom_rsi <- function(position = NULL,
position <- ggplot2::position_fill(vjust = 0.5, reverse = TRUE)
}
x <- x[1]
# we work with aes_string later on
x_deparse <- deparse(substitute(x))
if (x_deparse != "x") {

10
R/rsi.R
View File

@ -100,14 +100,14 @@
#' summary(example_isolates) # see all R/SI results at a glance
#'
#' if (require("skimr")) {
#' # support for skim() too:
#' # class <rsi> supported in skim() too:
#' skim(example_isolates)
#' }
#'
#' # For INTERPRETING disk diffusion and MIC values -----------------------
#'
#' # a whole data set, even with combined MIC values and disk zones
#' df <- data.frame(microorganism = "E. coli",
#' df <- data.frame(microorganism = "Escherichia coli",
#' AMP = as.mic(8),
#' CIP = as.mic(0.256),
#' GEN = as.disk(18),
@ -136,7 +136,7 @@
#' df %>% mutate(across(AMP:TOB, as.rsi))
#'
#' df %>%
#' mutate_at(vars(AMP:TOB), as.rsi, mo = "E. coli")
#' mutate_at(vars(AMP:TOB), as.rsi, mo = .$microorganism)
#'
#' # to include information about urinary tract infections (UTI)
#' data.frame(mo = "E. coli",
@ -457,7 +457,7 @@ as.rsi.data.frame <- function(x,
meet_criteria(x, allow_class = "data.frame") # will also check for dimensions > 0
meet_criteria(col_mo, allow_class = "character", is_in = colnames(x), allow_NULL = TRUE)
meet_criteria(guideline, allow_class = "character", has_length = 1)
meet_criteria(uti, allow_class = "logical", has_length = c(1, nrow(x)), allow_NULL = TRUE)
meet_criteria(uti, allow_class = c("logical", "character"), allow_NULL = TRUE)
meet_criteria(conserve_capped_values, allow_class = "logical", has_length = 1)
meet_criteria(add_intrinsic_resistance, allow_class = "logical", has_length = 1)
@ -482,6 +482,8 @@ as.rsi.data.frame <- function(x,
}
} else {
# column found, transform to logical
stop_if(length(col_uti) != 1 | !col_uti %in% colnames(x),
"argument `uti` must be a logical vector, of must be a single column name of `x`")
uti <- as.logical(x[, col_uti, drop = TRUE])
}
} else {

View File

@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="https://msberends.github.io/AMR//index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9003</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9004</span>
</span>
</div>

View File

@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<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">1.4.0.9003</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9004</span>
</span>
</div>

View File

@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<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">1.4.0.9003</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9004</span>
</span>
</div>

View File

@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<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">1.4.0.9003</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9004</span>
</span>
</div>

View File

@ -43,7 +43,7 @@
</button>
<span class="navbar-brand">
<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">1.4.0.9003</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9004</span>
</span>
</div>

View File

@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<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">1.4.0.9003</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9004</span>
</span>
</div>
@ -236,13 +236,13 @@
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
</div>
<div id="amr-1409003" class="section level1">
<h1 class="page-header" data-toc-text="1.4.0.9003">
<a href="#amr-1409003" class="anchor"></a>AMR 1.4.0.9003<small> Unreleased </small>
<div id="amr-1409004" class="section level1">
<h1 class="page-header" data-toc-text="1.4.0.9004">
<a href="#amr-1409004" class="anchor"></a>AMR 1.4.0.9004<small> Unreleased </small>
</h1>
<div id="last-updated-20-october-2020" class="section level2">
<div id="last-updated-21-october-2020" class="section level2">
<h2 class="hasAnchor">
<a href="#last-updated-20-october-2020" class="anchor"></a><small>Last updated: 20 October 2020</small>
<a href="#last-updated-21-october-2020" class="anchor"></a><small>Last updated: 21 October 2020</small>
</h2>
<div id="new" class="section level3">
<h3 class="hasAnchor">

View File

@ -12,7 +12,7 @@ articles:
datasets: datasets.html
resistance_predict: resistance_predict.html
welcome_to_AMR: welcome_to_AMR.html
last_built: 2020-10-20T18:59Z
last_built: 2020-10-21T09:40Z
urls:
reference: https://msberends.github.io/AMR//reference
article: https://msberends.github.io/AMR//articles

View File

@ -82,7 +82,7 @@
</button>
<span class="navbar-brand">
<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">1.4.0.9001</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9004</span>
</span>
</div>
@ -414,14 +414,14 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
<pre class="examples"><span class='fu'><a href='https://rdrr.io/r/base/summary.html'>summary</a></span><span class='op'>(</span><span class='va'>example_isolates</span><span class='op'>)</span> <span class='co'># see all R/SI results at a glance</span>
<span class='kw'>if</span> <span class='op'>(</span><span class='kw'><a href='https://rdrr.io/r/base/library.html'>require</a></span><span class='op'>(</span><span class='st'><a href='https://docs.ropensci.org/skimr'>"skimr"</a></span><span class='op'>)</span><span class='op'>)</span> <span class='op'>{</span>
<span class='co'># support for skim() too:</span>
<span class='co'># class &lt;rsi&gt; supported in skim() too:</span>
<span class='fu'><a href='https://docs.ropensci.org/skimr/reference/skim.html'>skim</a></span><span class='op'>(</span><span class='va'>example_isolates</span><span class='op'>)</span>
<span class='op'>}</span>
<span class='co'># For INTERPRETING disk diffusion and MIC values -----------------------</span>
<span class='co'># a whole data set, even with combined MIC values and disk zones</span>
<span class='va'>df</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a></span><span class='op'>(</span>microorganism <span class='op'>=</span> <span class='st'>"E. coli"</span>,
<span class='va'>df</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a></span><span class='op'>(</span>microorganism <span class='op'>=</span> <span class='st'>"Escherichia coli"</span>,
AMP <span class='op'>=</span> <span class='fu'><a href='as.mic.html'>as.mic</a></span><span class='op'>(</span><span class='fl'>8</span><span class='op'>)</span>,
CIP <span class='op'>=</span> <span class='fu'><a href='as.mic.html'>as.mic</a></span><span class='op'>(</span><span class='fl'>0.256</span><span class='op'>)</span>,
GEN <span class='op'>=</span> <span class='fu'><a href='as.disk.html'>as.disk</a></span><span class='op'>(</span><span class='fl'>18</span><span class='op'>)</span>,
@ -450,7 +450,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
<span class='va'>df</span> <span class='op'>%&gt;%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span><span class='op'>(</span><span class='fu'><a href='https://dplyr.tidyverse.org/reference/across.html'>across</a></span><span class='op'>(</span><span class='va'>AMP</span><span class='op'>:</span><span class='va'>TOB</span>, <span class='va'>as.rsi</span><span class='op'>)</span><span class='op'>)</span>
<span class='va'>df</span> <span class='op'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate_all.html'>mutate_at</a></span><span class='op'>(</span><span class='fu'><a href='https://dplyr.tidyverse.org/reference/vars.html'>vars</a></span><span class='op'>(</span><span class='va'>AMP</span><span class='op'>:</span><span class='va'>TOB</span><span class='op'>)</span>, <span class='va'>as.rsi</span>, mo <span class='op'>=</span> <span class='st'>"E. coli"</span><span class='op'>)</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate_all.html'>mutate_at</a></span><span class='op'>(</span><span class='fu'><a href='https://dplyr.tidyverse.org/reference/vars.html'>vars</a></span><span class='op'>(</span><span class='va'>AMP</span><span class='op'>:</span><span class='va'>TOB</span><span class='op'>)</span>, <span class='va'>as.rsi</span>, mo <span class='op'>=</span> <span class='va'>.</span><span class='op'>$</span><span class='va'>microorganism</span><span class='op'>)</span>
<span class='co'># to include information about urinary tract infections (UTI)</span>
<span class='fu'><a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a></span><span class='op'>(</span>mo <span class='op'>=</span> <span class='st'>"E. coli"</span>,

View File

@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<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">1.4.0.9003</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9004</span>
</span>
</div>

View File

@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<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">1.4.0.9003</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9004</span>
</span>
</div>

View File

@ -157,14 +157,14 @@ On our website \url{https://msberends.github.io/AMR/} you can find \href{https:/
summary(example_isolates) # see all R/SI results at a glance
if (require("skimr")) {
# support for skim() too:
# class <rsi> supported in skim() too:
skim(example_isolates)
}
# For INTERPRETING disk diffusion and MIC values -----------------------
# a whole data set, even with combined MIC values and disk zones
df <- data.frame(microorganism = "E. coli",
df <- data.frame(microorganism = "Escherichia coli",
AMP = as.mic(8),
CIP = as.mic(0.256),
GEN = as.disk(18),
@ -193,7 +193,7 @@ if (require("dplyr")) {
df \%>\% mutate(across(AMP:TOB, as.rsi))
df \%>\%
mutate_at(vars(AMP:TOB), as.rsi, mo = "E. coli")
mutate_at(vars(AMP:TOB), as.rsi, mo = .$microorganism)
# to include information about urinary tract infections (UTI)
data.frame(mo = "E. coli",