mirror of
https://github.com/msberends/AMR.git
synced 2024-12-25 07:26:12 +01:00
(v1.0.0.9003) prepare for short update
This commit is contained in:
parent
6408911922
commit
bb3728f023
@ -1,6 +1,6 @@
|
|||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 1.0.0.9002
|
Version: 1.0.0.9003
|
||||||
Date: 2020-02-20
|
Date: 2020-02-21
|
||||||
Title: Antimicrobial Resistance Analysis
|
Title: Antimicrobial Resistance Analysis
|
||||||
Authors@R: c(
|
Authors@R: c(
|
||||||
person(role = c("aut", "cre"),
|
person(role = c("aut", "cre"),
|
||||||
|
6
NEWS.md
6
NEWS.md
@ -1,8 +1,7 @@
|
|||||||
# AMR 1.0.0.9002
|
# AMR 1.0.0.9003
|
||||||
## <small>Last updated: 20-Feb-2020</small>
|
## <small>Last updated: 21-Feb-2020</small>
|
||||||
|
|
||||||
### Changed
|
### 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
|
* 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:
|
* Interpretation from MIC values to R/SI can now be used with `mutate_at()` of the dplyr package:
|
||||||
```r
|
```r
|
||||||
@ -12,6 +11,7 @@
|
|||||||
yourdata %>%
|
yourdata %>%
|
||||||
mutate_at(vars(antibiotic1:antibiotic25), as.rsi, mo = .$mybacteria)
|
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
|
* 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
|
# AMR 1.0.0
|
||||||
|
25
R/rsi.R
25
R/rsi.R
@ -67,6 +67,8 @@
|
|||||||
#' NIT = as.mic(32))
|
#' NIT = as.mic(32))
|
||||||
#' as.rsi(df)
|
#' as.rsi(df)
|
||||||
#'
|
#'
|
||||||
|
#' \donttest{
|
||||||
|
#'
|
||||||
#' # the dplyr way
|
#' # the dplyr way
|
||||||
#' library(dplyr)
|
#' library(dplyr)
|
||||||
#' df %>%
|
#' df %>%
|
||||||
@ -88,7 +90,8 @@
|
|||||||
#'
|
#'
|
||||||
#' df %>%
|
#' df %>%
|
||||||
#' mutate_at(vars(AMP:NIT), as.rsi, mo = "E. coli", uti = TRUE)
|
#' mutate_at(vars(AMP:NIT), as.rsi, mo = "E. coli", uti = TRUE)
|
||||||
#'
|
#' }
|
||||||
|
#'
|
||||||
#' # for single values
|
#' # for single values
|
||||||
#' as.rsi(x = as.mic(2),
|
#' as.rsi(x = as.mic(2),
|
||||||
#' mo = as.mo("S. pneumoniae"),
|
#' 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
|
#' @rdname as.rsi
|
||||||
#' @export
|
#' @export
|
||||||
as.rsi.mic <- function(x, mo, ab = deparse(substitute(x)), guideline = "EUCAST", uti = FALSE, ...) {
|
as.rsi.mic <- function(x, mo, ab = deparse(substitute(x)), guideline = "EUCAST", uti = FALSE, ...) {
|
||||||
@ -402,10 +391,14 @@ get_guideline <- function(guideline) {
|
|||||||
rev() %>%
|
rev() %>%
|
||||||
.[1]
|
.[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) {
|
if (!guideline_param %in% rsi_translation$guideline) {
|
||||||
stop(paste0("invalid guideline: '", 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)
|
call. = FALSE)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="https://msberends.gitlab.io/AMR/index.html">AMR (for R)</a>
|
<a class="navbar-link" href="https://msberends.gitlab.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.0.0.9002</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9003</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -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">1.0.0.9002</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9003</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -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">1.0.0.9002</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9003</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -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">1.0.0.9002</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9003</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -43,7 +43,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">1.0.0.9002</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9003</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -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">1.0.0.9002</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9003</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -219,19 +219,18 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="amr-1009002" class="section level1">
|
<div id="amr-1009003" class="section level1">
|
||||||
<h1 class="page-header">
|
<h1 class="page-header">
|
||||||
<a href="#amr-1009002" class="anchor"></a>AMR 1.0.0.9002<small> Unreleased </small>
|
<a href="#amr-1009003" class="anchor"></a>AMR 1.0.0.9003<small> Unreleased </small>
|
||||||
</h1>
|
</h1>
|
||||||
<div id="last-updated-20-feb-2020" class="section level2">
|
<div id="last-updated-21-feb-2020" class="section level2">
|
||||||
<h2 class="hasAnchor">
|
<h2 class="hasAnchor">
|
||||||
<a href="#last-updated-20-feb-2020" class="anchor"></a><small>Last updated: 20-Feb-2020</small>
|
<a href="#last-updated-21-feb-2020" class="anchor"></a><small>Last updated: 21-Feb-2020</small>
|
||||||
</h2>
|
</h2>
|
||||||
<div id="changed" class="section level3">
|
<div id="changed" class="section level3">
|
||||||
<h3 class="hasAnchor">
|
<h3 class="hasAnchor">
|
||||||
<a href="#changed" class="anchor"></a>Changed</h3>
|
<a href="#changed" class="anchor"></a>Changed</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li><p>Added antibiotic abbreviations for a laboratory manufacturer (GLIMS) for cefuroxime, cefotaxime, ceftazidime, cefepime, cefoxitin and trimethoprim/sulfamethoxazole</p></li>
|
|
||||||
<li><p>Fixed floating point error for some MIC compa in EUCAST 2020 guideline</p></li>
|
<li><p>Fixed floating point error for some MIC compa in EUCAST 2020 guideline</p></li>
|
||||||
<li>
|
<li>
|
||||||
<p>Interpretation from MIC values to R/SI can now be used with <code><a href="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_at()</a></code> of the dplyr package:</p>
|
<p>Interpretation from MIC values to R/SI can now be used with <code><a href="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_at()</a></code> of the dplyr package:</p>
|
||||||
@ -241,6 +240,7 @@
|
|||||||
<span id="cb1-4"><a href="#cb1-4"></a>yourdata <span class="op">%>%</span><span class="st"> </span></span>
|
<span id="cb1-4"><a href="#cb1-4"></a>yourdata <span class="op">%>%</span><span class="st"> </span></span>
|
||||||
<span id="cb1-5"><a href="#cb1-5"></a><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_at</a></span>(<span class="kw"><a href="https://dplyr.tidyverse.org/reference/vars.html">vars</a></span>(antibiotic1<span class="op">:</span>antibiotic25), as.rsi, <span class="dt">mo =</span> .<span class="op">$</span>mybacteria)</span></code></pre></div>
|
<span id="cb1-5"><a href="#cb1-5"></a><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_at</a></span>(<span class="kw"><a href="https://dplyr.tidyverse.org/reference/vars.html">vars</a></span>(antibiotic1<span class="op">:</span>antibiotic25), as.rsi, <span class="dt">mo =</span> .<span class="op">$</span>mybacteria)</span></code></pre></div>
|
||||||
</li>
|
</li>
|
||||||
|
<li><p>Added antibiotic abbreviations for a laboratory manufacturer (GLIMS) for cefuroxime, cefotaxime, ceftazidime, cefepime, cefoxitin and trimethoprim/sulfamethoxazole</p></li>
|
||||||
<li><p>Added <code>uti</code> (as abbreviation of urinary tract infections) as parameter to <code><a href="../reference/as.rsi.html">as.rsi()</a></code>, so interpretation of MIC values and disk zones can be made dependent on isolates specifically from UTIs</p></li>
|
<li><p>Added <code>uti</code> (as abbreviation of urinary tract infections) as parameter to <code><a href="../reference/as.rsi.html">as.rsi()</a></code>, so interpretation of MIC values and disk zones can be made dependent on isolates specifically from UTIs</p></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@ -1473,7 +1473,7 @@
|
|||||||
<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-1009002">1.0.0.9002</a></li>
|
<li><a href="#amr-1009003">1.0.0.9003</a></li>
|
||||||
<li><a href="#amr-100">1.0.0</a></li>
|
<li><a href="#amr-100">1.0.0</a></li>
|
||||||
<li><a href="#amr-090">0.9.0</a></li>
|
<li><a href="#amr-090">0.9.0</a></li>
|
||||||
<li><a href="#amr-080">0.8.0</a></li>
|
<li><a href="#amr-080">0.8.0</a></li>
|
||||||
|
@ -79,7 +79,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">1.0.0.9002</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9003</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -342,6 +342,8 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
|||||||
<span class='kw'>NIT</span> <span class='kw'>=</span> <span class='fu'><a href='as.mic.html'>as.mic</a></span>(<span class='fl'>32</span>))
|
<span class='kw'>NIT</span> <span class='kw'>=</span> <span class='fu'><a href='as.mic.html'>as.mic</a></span>(<span class='fl'>32</span>))
|
||||||
<span class='fu'>as.rsi</span>(<span class='no'>df</span>)
|
<span class='fu'>as.rsi</span>(<span class='no'>df</span>)
|
||||||
|
|
||||||
|
<span class='co'># \donttest{</span>
|
||||||
|
|
||||||
<span class='co'># the dplyr way</span>
|
<span class='co'># the dplyr way</span>
|
||||||
<span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='no'>dplyr</span>)
|
<span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='no'>dplyr</span>)
|
||||||
<span class='no'>df</span> <span class='kw'>%>%</span>
|
<span class='no'>df</span> <span class='kw'>%>%</span>
|
||||||
@ -363,6 +365,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
|||||||
|
|
||||||
<span class='no'>df</span> <span class='kw'>%>%</span>
|
<span class='no'>df</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate_all.html'>mutate_at</a></span>(<span class='fu'><a href='https://dplyr.tidyverse.org/reference/vars.html'>vars</a></span>(<span class='no'>AMP</span>:<span class='no'>NIT</span>), <span class='no'>as.rsi</span>, <span class='kw'>mo</span> <span class='kw'>=</span> <span class='st'>"E. coli"</span>, <span class='kw'>uti</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)
|
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate_all.html'>mutate_at</a></span>(<span class='fu'><a href='https://dplyr.tidyverse.org/reference/vars.html'>vars</a></span>(<span class='no'>AMP</span>:<span class='no'>NIT</span>), <span class='no'>as.rsi</span>, <span class='kw'>mo</span> <span class='kw'>=</span> <span class='st'>"E. coli"</span>, <span class='kw'>uti</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)
|
||||||
|
<span class='co'># }</span>
|
||||||
|
|
||||||
<span class='co'># for single values</span>
|
<span class='co'># for single values</span>
|
||||||
<span class='fu'>as.rsi</span>(<span class='kw'>x</span> <span class='kw'>=</span> <span class='fu'><a href='as.mic.html'>as.mic</a></span>(<span class='fl'>2</span>),
|
<span class='fu'>as.rsi</span>(<span class='kw'>x</span> <span class='kw'>=</span> <span class='fu'><a href='as.mic.html'>as.mic</a></span>(<span class='fl'>2</span>),
|
||||||
|
@ -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">1.0.0.9002</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9003</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -108,6 +108,8 @@ df <- data.frame(microorganism = "E. coli",
|
|||||||
NIT = as.mic(32))
|
NIT = as.mic(32))
|
||||||
as.rsi(df)
|
as.rsi(df)
|
||||||
|
|
||||||
|
\donttest{
|
||||||
|
|
||||||
# the dplyr way
|
# the dplyr way
|
||||||
library(dplyr)
|
library(dplyr)
|
||||||
df \%>\%
|
df \%>\%
|
||||||
@ -129,7 +131,8 @@ data.frame(mo = "E. coli",
|
|||||||
|
|
||||||
df \%>\%
|
df \%>\%
|
||||||
mutate_at(vars(AMP:NIT), as.rsi, mo = "E. coli", uti = TRUE)
|
mutate_at(vars(AMP:NIT), as.rsi, mo = "E. coli", uti = TRUE)
|
||||||
|
}
|
||||||
|
|
||||||
# for single values
|
# for single values
|
||||||
as.rsi(x = as.mic(2),
|
as.rsi(x = as.mic(2),
|
||||||
mo = as.mo("S. pneumoniae"),
|
mo = as.mo("S. pneumoniae"),
|
||||||
|
@ -34,6 +34,8 @@ test_that("rsi works", {
|
|||||||
barplot(as.rsi(c("S", "I", "R")))
|
barplot(as.rsi(c("S", "I", "R")))
|
||||||
plot(as.rsi(c("S", "I", "R")))
|
plot(as.rsi(c("S", "I", "R")))
|
||||||
print(as.rsi(c("S", "I", "R")))
|
print(as.rsi(c("S", "I", "R")))
|
||||||
|
|
||||||
|
expect_equal(as.character(as.rsi(c(1:3))), c("S", "I", "R"))
|
||||||
|
|
||||||
expect_equal(suppressWarnings(as.logical(as.rsi("INVALID VALUE"))), NA)
|
expect_equal(suppressWarnings(as.logical(as.rsi("INVALID VALUE"))), NA)
|
||||||
|
|
||||||
@ -55,9 +57,17 @@ test_that("rsi works", {
|
|||||||
as.logical() %>%
|
as.logical() %>%
|
||||||
sum(),
|
sum(),
|
||||||
40)
|
40)
|
||||||
|
|
||||||
|
expect_output(tibble(ab = as.rsi("S")))
|
||||||
|
|
||||||
|
expect_error(as.rsi.mic(as.mic(16)))
|
||||||
|
expect_error(as.rsi.disk(as.disk(16)))
|
||||||
|
|
||||||
|
expect_error(get_guideline("this one does not exist"))
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
test_that("mic2rsi works", {
|
test_that("mic2rsi works", {
|
||||||
|
|
||||||
skip_on_cran()
|
skip_on_cran()
|
||||||
|
Loading…
Reference in New Issue
Block a user