mirror of
https://github.com/msberends/AMR.git
synced 2024-12-26 16:46:13 +01:00
(v1.0.0.9001) add uti to as.rsi()
This commit is contained in:
parent
c6184a0fb8
commit
bdb26f624f
@ -1,5 +1,5 @@
|
|||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 1.0.0.9000
|
Version: 1.0.0.9001
|
||||||
Date: 2020-02-20
|
Date: 2020-02-20
|
||||||
Title: Antimicrobial Resistance Analysis
|
Title: Antimicrobial Resistance Analysis
|
||||||
Authors@R: c(
|
Authors@R: c(
|
||||||
|
4
NEWS.md
4
NEWS.md
@ -1,5 +1,5 @@
|
|||||||
# AMR 1.0.0.9000
|
# AMR 1.0.0.9001
|
||||||
## <small>Last updated: 20-Feb-2020</small>
|
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
* Added antibiotic abbreviations for a laboratory manufacturer (GLIMS) for cefuroxime, cefotaxime, ceftazidime, cefepime, cefoxitin and trimethoprim/sulfamethoxazole
|
* Added antibiotic abbreviations for a laboratory manufacturer (GLIMS) for cefuroxime, cefotaxime, ceftazidime, cefepime, cefoxitin and trimethoprim/sulfamethoxazole
|
||||||
|
27
R/rsi.R
27
R/rsi.R
@ -87,9 +87,7 @@
|
|||||||
#' as.rsi() # automatically determines urine isolates
|
#' as.rsi() # automatically determines urine isolates
|
||||||
#'
|
#'
|
||||||
#' df %>%
|
#' df %>%
|
||||||
#' mutate_at(vars(AMP:TOB), 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),
|
||||||
@ -139,12 +137,7 @@ as.rsi.default <- function(x, ...) {
|
|||||||
x
|
x
|
||||||
} else if (identical(levels(x), c("S", "I", "R"))) {
|
} else if (identical(levels(x), c("S", "I", "R"))) {
|
||||||
structure(x, class = c("rsi", "ordered", "factor"))
|
structure(x, class = c("rsi", "ordered", "factor"))
|
||||||
} else if (all_valid_mics(x) & !all(is.na(x))) {
|
} else if (inherits(x, "integer") & all(x %in% c(1:3, NA))) {
|
||||||
as.rsi(as.mic(x), ab = deparse(substitute(x)), ...)
|
|
||||||
} else if (all_valid_disks(x) & !all(is.na(x))) {
|
|
||||||
#message("These values seem to be disk diffusion diameters and were treated as such.")
|
|
||||||
as.rsi(as.disk(x), ab = deparse(substitute(x)), ...)
|
|
||||||
} else if (identical(class(x), "integer") & all(x %in% c(1:3, NA))) {
|
|
||||||
x[x == 1] <- "S"
|
x[x == 1] <- "S"
|
||||||
x[x == 2] <- "I"
|
x[x == 2] <- "I"
|
||||||
x[x == 3] <- "R"
|
x[x == 3] <- "R"
|
||||||
@ -152,6 +145,18 @@ as.rsi.default <- function(x, ...) {
|
|||||||
class = c("rsi", "ordered", "factor"))
|
class = c("rsi", "ordered", "factor"))
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
ab <- deparse(substitute(x))
|
||||||
|
if (!any(x %like% "(R|S|I)", na.rm = TRUE)) {
|
||||||
|
if (!is.na(suppressWarnings(as.ab(ab)))) {
|
||||||
|
# check if they are actually MICs or disks now that the antibiotic name is valid
|
||||||
|
if (all_valid_mics(x)) {
|
||||||
|
as.rsi(as.mic(x), ab = ab, ...)
|
||||||
|
} else if (all_valid_disks(x)) {
|
||||||
|
as.rsi(as.disk(x), ab = ab, ...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
x <- x %>% unlist()
|
x <- x %>% unlist()
|
||||||
x.bak <- x
|
x.bak <- x
|
||||||
|
|
||||||
@ -632,9 +637,9 @@ plot.rsi <- function(x,
|
|||||||
#' @importFrom graphics barplot axis par
|
#' @importFrom graphics barplot axis par
|
||||||
#' @noRd
|
#' @noRd
|
||||||
barplot.rsi <- function(height,
|
barplot.rsi <- function(height,
|
||||||
col = c("green3", "orange2", "red3"),
|
col = c("chartreuse4", "chartreuse3", "brown3"),
|
||||||
xlab = ifelse(beside, "Antimicrobial Interpretation", ""),
|
xlab = ifelse(beside, "Antimicrobial Interpretation", ""),
|
||||||
main = paste("Susceptibility Analysis of", deparse(substitute(height))),
|
main = paste("Antimicrobial resistance of", deparse(substitute(height))),
|
||||||
ylab = "Frequency",
|
ylab = "Frequency",
|
||||||
beside = TRUE,
|
beside = TRUE,
|
||||||
axes = beside,
|
axes = beside,
|
||||||
|
@ -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.9000</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9001</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.9000</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9001</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.9000</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9001</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.9000</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9001</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.9000</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9001</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.9000</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9001</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -219,14 +219,10 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="amr-1009000" class="section level1">
|
<div id="amr-1009001" class="section level1">
|
||||||
<h1 class="page-header">
|
<h1 class="page-header">
|
||||||
<a href="#amr-1009000" class="anchor"></a>AMR 1.0.0.9000<small> Unreleased </small>
|
<a href="#amr-1009001" class="anchor"></a>AMR 1.0.0.9001<small> Unreleased </small>
|
||||||
</h1>
|
</h1>
|
||||||
<div id="last-updated-20-feb-2020" class="section level2">
|
|
||||||
<h2 class="hasAnchor">
|
|
||||||
<a href="#last-updated-20-feb-2020" class="anchor"></a><small>Last updated: 20-Feb-2020</small>
|
|
||||||
</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>
|
||||||
@ -244,7 +240,6 @@
|
|||||||
<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>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div id="amr-100" class="section level1">
|
<div id="amr-100" class="section level1">
|
||||||
<h1 class="page-header">
|
<h1 class="page-header">
|
||||||
@ -1473,7 +1468,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-1009000">1.0.0.9000</a></li>
|
<li><a href="#amr-1009001">1.0.0.9001</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">0.9.0.9029</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9001</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -362,9 +362,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
|||||||
<span class='fu'>as.rsi</span>() <span class='co'># automatically determines urine isolates</span>
|
<span class='fu'>as.rsi</span>() <span class='co'># automatically determines urine isolates</span>
|
||||||
|
|
||||||
<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'>TOB</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'># 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.9000</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9001</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -128,9 +128,7 @@ data.frame(mo = "E. coli",
|
|||||||
as.rsi() # automatically determines urine isolates
|
as.rsi() # automatically determines urine isolates
|
||||||
|
|
||||||
df \%>\%
|
df \%>\%
|
||||||
mutate_at(vars(AMP:TOB), 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),
|
||||||
|
Loading…
Reference in New Issue
Block a user