diff --git a/DESCRIPTION b/DESCRIPTION
index 8b342075..4fb8a474 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,5 +1,5 @@
Package: AMR
-Version: 1.2.0.9040
+Version: 1.3.0
Date: 2020-07-29
Title: Antimicrobial Resistance Analysis
Authors@R: c(
diff --git a/NEWS.md b/NEWS.md
index b281a667..35b24613 100755
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,5 +1,5 @@
-# AMR 1.2.0.9040
-## Last updated: 29 July 2020
+# AMR 1.3.0
+
### 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
diff --git a/R/rsi.R b/R/rsi.R
index ee2eae43..447fc94f 100755
--- a/R/rsi.R
+++ b/R/rsi.R
@@ -143,6 +143,40 @@ as.rsi <- function(x, ...) {
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
as.rsi.default <- function(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"))
}
-#' @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
#' @export
#' @noRd
diff --git a/docs/404.html b/docs/404.html
index a01823d6..c7406dcc 100644
--- a/docs/404.html
+++ b/docs/404.html
@@ -81,7 +81,7 @@
NEWS.md
-
as.rsi(x, ...) +is.rsi(x) + +is.rsi.eligible(x, threshold = 0.05) + # S3 method for mic as.rsi( x, @@ -266,11 +270,7 @@ uti = NULL, conserve_capped_values = FALSE, ... -) - -is.rsi(x) - -is.rsi.eligible(x, threshold = 0.05)+)
... | parameters passed on to methods |
+ ||
---|---|---|---|
threshold | +maximum fraction of invalid antimicrobial interpretations of |
+ ||
mo | any (vector of) text that can be coerced to a valid microorganism code with |
@@ -307,10 +311,6 @@
col_mo | column name of the IDs of the microorganisms (see |
threshold | -maximum fraction of invalid antimicrobial interpretations of |
-