mirror of
https://github.com/msberends/AMR.git
synced 2024-12-26 06:06:12 +01:00
(v1.3.0) v1.3.0
This commit is contained in:
parent
de0f7b8950
commit
ea4e5e5b81
@ -1,5 +1,5 @@
|
|||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 1.2.0.9040
|
Version: 1.3.0
|
||||||
Date: 2020-07-29
|
Date: 2020-07-29
|
||||||
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.2.0.9040
|
# AMR 1.3.0
|
||||||
## <small>Last updated: 29 July 2020</small>
|
|
||||||
|
|
||||||
### New
|
### New
|
||||||
* Function `ab_from_text()` to retrieve antimicrobial drug names, doses and forms of administration from clinical texts in e.g. health care records, which also corrects for misspelling since it uses `as.ab()` internally
|
* Function `ab_from_text()` to retrieve antimicrobial drug names, doses and forms of administration from clinical texts in e.g. health care records, which also corrects for misspelling since it uses `as.ab()` internally
|
||||||
|
68
R/rsi.R
68
R/rsi.R
@ -143,6 +143,40 @@ as.rsi <- function(x, ...) {
|
|||||||
UseMethod("as.rsi")
|
UseMethod("as.rsi")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#' @rdname as.rsi
|
||||||
|
#' @export
|
||||||
|
is.rsi <- function(x) {
|
||||||
|
inherits(x, "rsi")
|
||||||
|
}
|
||||||
|
|
||||||
|
#' @rdname as.rsi
|
||||||
|
#' @export
|
||||||
|
is.rsi.eligible <- function(x, threshold = 0.05) {
|
||||||
|
stop_if(NCOL(x) > 1, "`x` must be a one-dimensional vector.")
|
||||||
|
|
||||||
|
if (any(c("logical",
|
||||||
|
"numeric",
|
||||||
|
"integer",
|
||||||
|
"mo",
|
||||||
|
"Date",
|
||||||
|
"POSIXct",
|
||||||
|
"rsi",
|
||||||
|
"raw",
|
||||||
|
"hms")
|
||||||
|
%in% class(x))) {
|
||||||
|
# no transformation needed
|
||||||
|
FALSE
|
||||||
|
} else {
|
||||||
|
x <- x[!is.na(x) & !is.null(x) & !identical(x, "")]
|
||||||
|
if (length(x) == 0) {
|
||||||
|
return(FALSE)
|
||||||
|
}
|
||||||
|
checked <- suppressWarnings(as.rsi(x))
|
||||||
|
outcome <- sum(is.na(checked)) / length(x)
|
||||||
|
outcome <= threshold
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#' @export
|
#' @export
|
||||||
as.rsi.default <- function(x, ...) {
|
as.rsi.default <- function(x, ...) {
|
||||||
if (is.rsi(x)) {
|
if (is.rsi(x)) {
|
||||||
@ -513,40 +547,6 @@ exec_as.rsi <- function(method, x, mo, ab, guideline, uti, conserve_capped_value
|
|||||||
class = c("rsi", "ordered", "factor"))
|
class = c("rsi", "ordered", "factor"))
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname as.rsi
|
|
||||||
#' @export
|
|
||||||
is.rsi <- function(x) {
|
|
||||||
inherits(x, "rsi")
|
|
||||||
}
|
|
||||||
|
|
||||||
#' @rdname as.rsi
|
|
||||||
#' @export
|
|
||||||
is.rsi.eligible <- function(x, threshold = 0.05) {
|
|
||||||
stop_if(NCOL(x) > 1, "`x` must be a one-dimensional vector.")
|
|
||||||
|
|
||||||
if (any(c("logical",
|
|
||||||
"numeric",
|
|
||||||
"integer",
|
|
||||||
"mo",
|
|
||||||
"Date",
|
|
||||||
"POSIXct",
|
|
||||||
"rsi",
|
|
||||||
"raw",
|
|
||||||
"hms")
|
|
||||||
%in% class(x))) {
|
|
||||||
# no transformation needed
|
|
||||||
FALSE
|
|
||||||
} else {
|
|
||||||
x <- x[!is.na(x) & !is.null(x) & !identical(x, "")]
|
|
||||||
if (length(x) == 0) {
|
|
||||||
return(FALSE)
|
|
||||||
}
|
|
||||||
checked <- suppressWarnings(as.rsi(x))
|
|
||||||
outcome <- sum(is.na(checked)) / length(x)
|
|
||||||
outcome <= threshold
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#' @method print rsi
|
#' @method print rsi
|
||||||
#' @export
|
#' @export
|
||||||
#' @noRd
|
#' @noRd
|
||||||
|
@ -81,7 +81,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="Latest development version">1.2.0.9040</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -81,7 +81,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.2.0.9040</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -81,7 +81,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.2.0.9040</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -81,7 +81,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.2.0.9040</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0</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.2.0.9040</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -81,7 +81,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.2.0.9040</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -229,14 +229,10 @@
|
|||||||
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
|
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="amr-1209040" class="section level1">
|
<div id="amr-130" class="section level1">
|
||||||
<h1 class="page-header" data-toc-text="1.2.0.9040">
|
<h1 class="page-header" data-toc-text="1.3.0">
|
||||||
<a href="#amr-1209040" class="anchor"></a>AMR 1.2.0.9040<small> Unreleased </small>
|
<a href="#amr-130" class="anchor"></a>AMR 1.3.0<small> Unreleased </small>
|
||||||
</h1>
|
</h1>
|
||||||
<div id="last-updated-29-july-2020" class="section level2">
|
|
||||||
<h2 class="hasAnchor">
|
|
||||||
<a href="#last-updated-29-july-2020" class="anchor"></a><small>Last updated: 29 July 2020</small>
|
|
||||||
</h2>
|
|
||||||
<div id="new" class="section level3">
|
<div id="new" class="section level3">
|
||||||
<h3 class="hasAnchor">
|
<h3 class="hasAnchor">
|
||||||
<a href="#new" class="anchor"></a>New</h3>
|
<a href="#new" class="anchor"></a>New</h3>
|
||||||
@ -311,7 +307,6 @@
|
|||||||
<li>Moved primary location of this project from GitLab to <a href="https://github.com/msberends/AMR">GitHub</a>, giving us native support for automated syntax checking without being dependent on external services such as AppVeyor and Travis CI.</li>
|
<li>Moved primary location of this project from GitLab to <a href="https://github.com/msberends/AMR">GitHub</a>, giving us native support for automated syntax checking without being dependent on external services such as AppVeyor and Travis CI.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div id="amr-120" class="section level1">
|
<div id="amr-120" class="section level1">
|
||||||
<h1 class="page-header" data-toc-text="1.2.0">
|
<h1 class="page-header" data-toc-text="1.2.0">
|
||||||
|
@ -10,7 +10,7 @@ articles:
|
|||||||
WHONET: WHONET.html
|
WHONET: WHONET.html
|
||||||
benchmarks: benchmarks.html
|
benchmarks: benchmarks.html
|
||||||
resistance_predict: resistance_predict.html
|
resistance_predict: resistance_predict.html
|
||||||
last_built: 2020-07-29T10:44Z
|
last_built: 2020-07-29T11:47Z
|
||||||
urls:
|
urls:
|
||||||
reference: https://msberends.github.io/AMR/reference
|
reference: https://msberends.github.io/AMR/reference
|
||||||
article: https://msberends.github.io/AMR/articles
|
article: https://msberends.github.io/AMR/articles
|
||||||
|
@ -82,7 +82,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.2.0.9040</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -237,6 +237,10 @@
|
|||||||
|
|
||||||
<pre class="usage"><span class='fu'>as.rsi</span>(<span class='no'>x</span>, <span class='no'>...</span>)
|
<pre class="usage"><span class='fu'>as.rsi</span>(<span class='no'>x</span>, <span class='no'>...</span>)
|
||||||
|
|
||||||
|
<span class='fu'>is.rsi</span>(<span class='no'>x</span>)
|
||||||
|
|
||||||
|
<span class='fu'>is.rsi.eligible</span>(<span class='no'>x</span>, <span class='kw'>threshold</span> <span class='kw'>=</span> <span class='fl'>0.05</span>)
|
||||||
|
|
||||||
<span class='co'># S3 method for mic</span>
|
<span class='co'># S3 method for mic</span>
|
||||||
<span class='fu'>as.rsi</span>(
|
<span class='fu'>as.rsi</span>(
|
||||||
<span class='no'>x</span>,
|
<span class='no'>x</span>,
|
||||||
@ -266,11 +270,7 @@
|
|||||||
<span class='kw'>uti</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
|
<span class='kw'>uti</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
|
||||||
<span class='kw'>conserve_capped_values</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>,
|
<span class='kw'>conserve_capped_values</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>,
|
||||||
<span class='no'>...</span>
|
<span class='no'>...</span>
|
||||||
)
|
)</pre>
|
||||||
|
|
||||||
<span class='fu'>is.rsi</span>(<span class='no'>x</span>)
|
|
||||||
|
|
||||||
<span class='fu'>is.rsi.eligible</span>(<span class='no'>x</span>, <span class='kw'>threshold</span> <span class='kw'>=</span> <span class='fl'>0.05</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">
|
||||||
@ -283,6 +283,10 @@
|
|||||||
<th>...</th>
|
<th>...</th>
|
||||||
<td><p>parameters passed on to methods</p></td>
|
<td><p>parameters passed on to methods</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>threshold</th>
|
||||||
|
<td><p>maximum fraction of invalid antimicrobial interpretations of <code>x</code>, please see <em>Examples</em></p></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>mo</th>
|
<th>mo</th>
|
||||||
<td><p>any (vector of) text that can be coerced to a valid microorganism code with <code><a href='as.mo.html'>as.mo()</a></code></p></td>
|
<td><p>any (vector of) text that can be coerced to a valid microorganism code with <code><a href='as.mo.html'>as.mo()</a></code></p></td>
|
||||||
@ -307,10 +311,6 @@
|
|||||||
<th>col_mo</th>
|
<th>col_mo</th>
|
||||||
<td><p>column name of the IDs of the microorganisms (see <code><a href='as.mo.html'>as.mo()</a></code>), defaults to the first column of class <code><a href='as.mo.html'>mo</a></code>. Values will be coerced using <code><a href='as.mo.html'>as.mo()</a></code>.</p></td>
|
<td><p>column name of the IDs of the microorganisms (see <code><a href='as.mo.html'>as.mo()</a></code>), defaults to the first column of class <code><a href='as.mo.html'>mo</a></code>. Values will be coerced using <code><a href='as.mo.html'>as.mo()</a></code>.</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<th>threshold</th>
|
|
||||||
<td><p>maximum fraction of invalid antimicrobial interpretations of <code>x</code>, please see <em>Examples</em></p></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
|
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
|
||||||
|
@ -81,7 +81,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.2.0.9040</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -82,7 +82,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.2.0.9038</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -81,7 +81,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.2.0.9040</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -3,15 +3,19 @@
|
|||||||
\name{as.rsi}
|
\name{as.rsi}
|
||||||
\alias{as.rsi}
|
\alias{as.rsi}
|
||||||
\alias{rsi}
|
\alias{rsi}
|
||||||
|
\alias{is.rsi}
|
||||||
|
\alias{is.rsi.eligible}
|
||||||
\alias{as.rsi.mic}
|
\alias{as.rsi.mic}
|
||||||
\alias{as.rsi.disk}
|
\alias{as.rsi.disk}
|
||||||
\alias{as.rsi.data.frame}
|
\alias{as.rsi.data.frame}
|
||||||
\alias{is.rsi}
|
|
||||||
\alias{is.rsi.eligible}
|
|
||||||
\title{Class 'rsi'}
|
\title{Class 'rsi'}
|
||||||
\usage{
|
\usage{
|
||||||
as.rsi(x, ...)
|
as.rsi(x, ...)
|
||||||
|
|
||||||
|
is.rsi(x)
|
||||||
|
|
||||||
|
is.rsi.eligible(x, threshold = 0.05)
|
||||||
|
|
||||||
\method{as.rsi}{mic}(
|
\method{as.rsi}{mic}(
|
||||||
x,
|
x,
|
||||||
mo,
|
mo,
|
||||||
@ -39,16 +43,14 @@ as.rsi(x, ...)
|
|||||||
conserve_capped_values = FALSE,
|
conserve_capped_values = FALSE,
|
||||||
...
|
...
|
||||||
)
|
)
|
||||||
|
|
||||||
is.rsi(x)
|
|
||||||
|
|
||||||
is.rsi.eligible(x, threshold = 0.05)
|
|
||||||
}
|
}
|
||||||
\arguments{
|
\arguments{
|
||||||
\item{x}{vector of values (for class \code{\link{mic}}: an MIC value in mg/L, for class \code{\link{disk}}: a disk diffusion radius in millimetres)}
|
\item{x}{vector of values (for class \code{\link{mic}}: an MIC value in mg/L, for class \code{\link{disk}}: a disk diffusion radius in millimetres)}
|
||||||
|
|
||||||
\item{...}{parameters passed on to methods}
|
\item{...}{parameters passed on to methods}
|
||||||
|
|
||||||
|
\item{threshold}{maximum fraction of invalid antimicrobial interpretations of \code{x}, please see \emph{Examples}}
|
||||||
|
|
||||||
\item{mo}{any (vector of) text that can be coerced to a valid microorganism code with \code{\link[=as.mo]{as.mo()}}}
|
\item{mo}{any (vector of) text that can be coerced to a valid microorganism code with \code{\link[=as.mo]{as.mo()}}}
|
||||||
|
|
||||||
\item{ab}{any (vector of) text that can be coerced to a valid antimicrobial code with \code{\link[=as.ab]{as.ab()}}}
|
\item{ab}{any (vector of) text that can be coerced to a valid antimicrobial code with \code{\link[=as.ab]{as.ab()}}}
|
||||||
@ -60,8 +62,6 @@ is.rsi.eligible(x, threshold = 0.05)
|
|||||||
\item{conserve_capped_values}{a logical to indicate that MIC values starting with \code{">"} (but not \code{">="}) must always return "R" , and that MIC values starting with \code{"<"} (but not \code{"<="}) must always return "S"}
|
\item{conserve_capped_values}{a logical to indicate that MIC values starting with \code{">"} (but not \code{">="}) must always return "R" , and that MIC values starting with \code{"<"} (but not \code{"<="}) must always return "S"}
|
||||||
|
|
||||||
\item{col_mo}{column name of the IDs of the microorganisms (see \code{\link[=as.mo]{as.mo()}}), defaults to the first column of class \code{\link{mo}}. Values will be coerced using \code{\link[=as.mo]{as.mo()}}.}
|
\item{col_mo}{column name of the IDs of the microorganisms (see \code{\link[=as.mo]{as.mo()}}), defaults to the first column of class \code{\link{mo}}. Values will be coerced using \code{\link[=as.mo]{as.mo()}}.}
|
||||||
|
|
||||||
\item{threshold}{maximum fraction of invalid antimicrobial interpretations of \code{x}, please see \emph{Examples}}
|
|
||||||
}
|
}
|
||||||
\value{
|
\value{
|
||||||
Ordered factor with new class \code{\link{rsi}}
|
Ordered factor with new class \code{\link{rsi}}
|
||||||
|
Loading…
Reference in New Issue
Block a user