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

(v1.8.1.9010) random when pkg not loaded

This commit is contained in:
dr. M.S. (Matthijs) Berends 2022-05-16 12:52:50 +02:00
parent 2c5bc73ed6
commit 70a07bad39
14 changed files with 25 additions and 35 deletions

View File

@ -1,5 +1,5 @@
Package: AMR Package: AMR
Version: 1.8.1.9009 Version: 1.8.1.9010
Date: 2022-05-16 Date: 2022-05-16
Title: Antimicrobial Resistance Data Analysis Title: Antimicrobial Resistance Data Analysis
Description: Functions to simplify and standardise antimicrobial resistance (AMR) Description: Functions to simplify and standardise antimicrobial resistance (AMR)

View File

@ -1,4 +1,4 @@
# `AMR` 1.8.1.9009 # `AMR` 1.8.1.9010
## <small>Last updated: 16 May 2022</small> ## <small>Last updated: 16 May 2022</small>
### New ### New

View File

@ -47,6 +47,7 @@ valid_mic_levels <- c(c(t(vapply(FUN.VALUE = character(9), ops,
#' @rdname as.mic #' @rdname as.mic
#' @param x a [character] or [numeric] vector #' @param x a [character] or [numeric] vector
#' @param na.rm a [logical] indicating whether missing values should be removed #' @param na.rm a [logical] indicating whether missing values should be removed
#' @param ... arguments passed on to methods
#' @details To interpret MIC values as RSI values, use [as.rsi()] on MIC values. It supports guidelines from EUCAST (`r min(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "EUCAST")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "EUCAST")$guideline)))`) and CLSI (`r min(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "CLSI")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "CLSI")$guideline)))`). #' @details To interpret MIC values as RSI values, use [as.rsi()] on MIC values. It supports guidelines from EUCAST (`r min(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "EUCAST")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "EUCAST")$guideline)))`) and CLSI (`r min(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "CLSI")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "CLSI")$guideline)))`).
#' #'
#' This class for MIC values is a quite a special data type: formally it is an ordered [factor] with valid MIC values as [factor] levels (to make sure only valid MIC values are retained), but for any mathematical operation it acts as decimal numbers: #' This class for MIC values is a quite a special data type: formally it is an ordered [factor] with valid MIC values as [factor] levels (to make sure only valid MIC values are retained), but for any mathematical operation it acts as decimal numbers:
@ -228,11 +229,10 @@ as.numeric.mic <- function(x, ...) {
#' @rdname as.mic #' @rdname as.mic
#' @method droplevels mic #' @method droplevels mic
#' @param exclude factor levels which should be excluded from the result even if present, see [droplevels()][base::droplevels()]
#' @param as.mic a [logical] to indicate whether the `<mic>` class should be kept, defaults to `FALSE` #' @param as.mic a [logical] to indicate whether the `<mic>` class should be kept, defaults to `FALSE`
#' @export #' @export
droplevels.mic <- function(x, exclude = if (any(is.na(levels(x)))) NULL else NA, as.mic = FALSE, ...) { droplevels.mic <- function(x, as.mic = FALSE, ...) {
x <- droplevels.factor(x, exclude = exclude, ...) x <- droplevels.factor(x, ...)
if (as.mic == TRUE) { if (as.mic == TRUE) {
class(x) <- c("mic", "ordered", "factor") class(x) <- c("mic", "ordered", "factor")
} }

Binary file not shown.

View File

@ -43,7 +43,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="https://msberends.github.io/AMR/index.html">AMR (for R)</a> <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="Released version">1.8.1.9009</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9010</span>
</span> </span>
</div> </div>

View File

@ -17,7 +17,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="Released version">1.8.1.9009</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9010</span>
</span> </span>
</div> </div>

View File

@ -44,7 +44,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="Released version">1.8.1.9009</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9010</span>
</span> </span>
</div> </div>

View File

@ -17,7 +17,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="Released version">1.8.1.9009</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9010</span>
</span> </span>
</div> </div>

View File

@ -47,7 +47,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="Released version">1.8.1.9009</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9010</span>
</span> </span>
</div> </div>

View File

@ -17,7 +17,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="Released version">1.8.1.9009</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9010</span>
</span> </span>
</div> </div>
@ -157,16 +157,16 @@
</div> </div>
<div class="section level2"> <div class="section level2">
<h2 class="page-header" data-toc-text="1.8.1.9009" id="amr-1819009"> <h2 class="page-header" data-toc-text="1.8.1.9010" id="amr-1819010">
<code>AMR</code> 1.8.1.9009<a class="anchor" aria-label="anchor" href="#amr-1819009"></a></h2> <code>AMR</code> 1.8.1.9010<a class="anchor" aria-label="anchor" href="#amr-1819010"></a></h2>
<div class="section level3"> <div class="section level3">
<h3 id="last-updated-may-1-8-1-9009"><small>Last updated: 16 May 2022</small><a class="anchor" aria-label="anchor" href="#last-updated-may-1-8-1-9009"></a></h3> <h3 id="last-updated-may-1-8-1-9010"><small>Last updated: 16 May 2022</small><a class="anchor" aria-label="anchor" href="#last-updated-may-1-8-1-9010"></a></h3>
<div class="section level4"> <div class="section level4">
<h4 id="new-1-8-1-9009">New<a class="anchor" aria-label="anchor" href="#new-1-8-1-9009"></a></h4> <h4 id="new-1-8-1-9010">New<a class="anchor" aria-label="anchor" href="#new-1-8-1-9010"></a></h4>
<ul><li>EUCAST 2022 and CLSI 2022 guidelines have been added for <code><a href="../reference/as.rsi.html">as.rsi()</a></code>. EUCAST 2022 is now the new default guideline for all MIC and disks diffusion interpretations.</li> <ul><li>EUCAST 2022 and CLSI 2022 guidelines have been added for <code><a href="../reference/as.rsi.html">as.rsi()</a></code>. EUCAST 2022 is now the new default guideline for all MIC and disks diffusion interpretations.</li>
</ul></div> </ul></div>
<div class="section level4"> <div class="section level4">
<h4 id="changed-1-8-1-9009">Changed<a class="anchor" aria-label="anchor" href="#changed-1-8-1-9009"></a></h4> <h4 id="changed-1-8-1-9010">Changed<a class="anchor" aria-label="anchor" href="#changed-1-8-1-9010"></a></h4>
<ul><li>Fix for <code><a href="../reference/as.rsi.html">as.rsi()</a></code> on certain EUCAST breakpoints for MIC values</li> <ul><li>Fix for <code><a href="../reference/as.rsi.html">as.rsi()</a></code> on certain EUCAST breakpoints for MIC values</li>
<li>Removed <code><a href="https://rdrr.io/r/base/integer.html" class="external-link">as.integer()</a></code> for MIC values, since MIC are not integer values and running <code><a href="https://rdrr.io/r/base/table.html" class="external-link">table()</a></code> on MIC values consequently failed for not being able to retrieve the level position (as thats how normally <code><a href="https://rdrr.io/r/base/integer.html" class="external-link">as.integer()</a></code> on <code>factor</code>s work)</li> <li>Removed <code><a href="https://rdrr.io/r/base/integer.html" class="external-link">as.integer()</a></code> for MIC values, since MIC are not integer values and running <code><a href="https://rdrr.io/r/base/table.html" class="external-link">table()</a></code> on MIC values consequently failed for not being able to retrieve the level position (as thats how normally <code><a href="https://rdrr.io/r/base/integer.html" class="external-link">as.integer()</a></code> on <code>factor</code>s work)</li>
<li> <li>

View File

@ -17,7 +17,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="Released version">1.8.1.9007</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9010</span>
</span> </span>
</div> </div>
@ -169,12 +169,7 @@
<span class="fu">is.mic</span><span class="op">(</span><span class="va">x</span><span class="op">)</span> <span class="fu">is.mic</span><span class="op">(</span><span class="va">x</span><span class="op">)</span>
<span class="co"># S3 method for mic</span> <span class="co"># S3 method for mic</span>
<span class="fu"><a href="https://rdrr.io/r/base/droplevels.html" class="external-link">droplevels</a></span><span class="op">(</span> <span class="fu"><a href="https://rdrr.io/r/base/droplevels.html" class="external-link">droplevels</a></span><span class="op">(</span><span class="va">x</span>, as.mic <span class="op">=</span> <span class="cn">FALSE</span>, <span class="va">...</span><span class="op">)</span></code></pre></div>
<span class="va">x</span>,
exclude <span class="op">=</span> <span class="kw">if</span> <span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/any.html" class="external-link">any</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/NA.html" class="external-link">is.na</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/levels.html" class="external-link">levels</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span><span class="op">)</span><span class="op">)</span><span class="op">)</span> <span class="cn">NULL</span> <span class="kw">else</span> <span class="cn">NA</span>,
as.mic <span class="op">=</span> <span class="cn">FALSE</span>,
<span class="va">...</span>
<span class="op">)</span></code></pre></div>
</div> </div>
<div id="arguments"> <div id="arguments">
@ -183,10 +178,10 @@
<dd><p>a <a href="https://rdrr.io/r/base/character.html" class="external-link">character</a> or <a href="https://rdrr.io/r/base/numeric.html" class="external-link">numeric</a> vector</p></dd> <dd><p>a <a href="https://rdrr.io/r/base/character.html" class="external-link">character</a> or <a href="https://rdrr.io/r/base/numeric.html" class="external-link">numeric</a> vector</p></dd>
<dt>na.rm</dt> <dt>na.rm</dt>
<dd><p>a <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a> indicating whether missing values should be removed</p></dd> <dd><p>a <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a> indicating whether missing values should be removed</p></dd>
<dt>exclude</dt>
<dd><p>factor levels which should be excluded from the result even if present, see <a href="https://rdrr.io/r/base/droplevels.html" class="external-link">droplevels()</a></p></dd>
<dt>as.mic</dt> <dt>as.mic</dt>
<dd><p>a <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a> to indicate whether the <code>&lt;mic&gt;</code> class should be kept, defaults to <code>FALSE</code></p></dd> <dd><p>a <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a> to indicate whether the <code>&lt;mic&gt;</code> class should be kept, defaults to <code>FALSE</code></p></dd>
<dt>...</dt>
<dd><p>arguments passed on to methods</p></dd>
</dl></div> </dl></div>
<div id="value"> <div id="value">
<h2>Value</h2> <h2>Value</h2>

View File

@ -17,7 +17,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="Released version">1.8.1.9009</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9010</span>
</span> </span>
</div> </div>

View File

@ -17,7 +17,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="Released version">1.8.1.9009</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9010</span>
</span> </span>
</div> </div>

View File

@ -15,21 +15,16 @@ NA_mic_
is.mic(x) is.mic(x)
\method{droplevels}{mic}( \method{droplevels}{mic}(x, as.mic = FALSE, ...)
x,
exclude = if (any(is.na(levels(x)))) NULL else NA,
as.mic = FALSE,
...
)
} }
\arguments{ \arguments{
\item{x}{a \link{character} or \link{numeric} vector} \item{x}{a \link{character} or \link{numeric} vector}
\item{na.rm}{a \link{logical} indicating whether missing values should be removed} \item{na.rm}{a \link{logical} indicating whether missing values should be removed}
\item{exclude}{factor levels which should be excluded from the result even if present, see \link[base:droplevels]{droplevels()}}
\item{as.mic}{a \link{logical} to indicate whether the \verb{<mic>} class should be kept, defaults to \code{FALSE}} \item{as.mic}{a \link{logical} to indicate whether the \verb{<mic>} class should be kept, defaults to \code{FALSE}}
\item{...}{arguments passed on to methods}
} }
\value{ \value{
Ordered \link{factor} with additional class \code{\link{mic}}, that in mathematical operations acts as decimal numbers. Bare in mind that the outcome of any mathematical operation on MICs will return a \link{numeric} value. Ordered \link{factor} with additional class \code{\link{mic}}, that in mathematical operations acts as decimal numbers. Bare in mind that the outcome of any mathematical operation on MICs will return a \link{numeric} value.