From 2134fc76e21712c991021b8d3420c407b137c03e Mon Sep 17 00:00:00 2001 From: "Matthijs S. Berends" Date: Fri, 3 Jul 2020 12:14:41 +0200 Subject: [PATCH] (v1.2.0.9025) AMR calculation speed improvement --- DESCRIPTION | 2 +- NEWS.md | 2 +- R/rsi_calc.R | 5 ++++- docs/404.html | 2 +- docs/LICENSE-text.html | 2 +- docs/articles/index.html | 2 +- docs/authors.html | 2 +- docs/index.html | 2 +- docs/news/index.html | 8 ++++---- docs/pkgdown.yml | 2 +- docs/reference/index.html | 2 +- 11 files changed, 17 insertions(+), 14 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 6a844944..272b1141 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: AMR -Version: 1.2.0.9024 +Version: 1.2.0.9025 Date: 2020-07-03 Title: Antimicrobial Resistance Analysis Authors@R: c( diff --git a/NEWS.md b/NEWS.md index c9d5a484..2c71df03 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 1.2.0.9024 +# AMR 1.2.0.9025 ## Last updated: 03-Jul-2020 ### New diff --git a/R/rsi_calc.R b/R/rsi_calc.R index 343b08c7..c92d9ba0 100755 --- a/R/rsi_calc.R +++ b/R/rsi_calc.R @@ -116,7 +116,10 @@ rsi_calc <- function(..., x_transposed <- as.list(as.data.frame(t(x))) if (only_all_tested == TRUE) { # no NAs in any column - numerator <- sum(sapply(x_transposed, function(y) !any(is.na(y)) & any(y %in% ab_result, na.rm = TRUE))) + y <- apply(X = as.data.frame(lapply(x, as.integer), stringsAsFactors = FALSE), + MARGIN = 1, + FUN = base::min) + numerator <- sum(as.integer(y) %in% as.integer(ab_result), na.rm = TRUE) denominator <- sum(sapply(x_transposed, function(y) !(any(is.na(y))))) } else { # may contain NAs in any column diff --git a/docs/404.html b/docs/404.html index bd952060..21defab2 100644 --- a/docs/404.html +++ b/docs/404.html @@ -81,7 +81,7 @@ AMR (for R) - 1.2.0.9024 + 1.2.0.9025 diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index dcbcdb94..1d8b6b32 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -81,7 +81,7 @@ AMR (for R) - 1.2.0.9024 + 1.2.0.9025 diff --git a/docs/articles/index.html b/docs/articles/index.html index 81a34fab..bbceaf2f 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.2.0.9024 + 1.2.0.9025 diff --git a/docs/authors.html b/docs/authors.html index bd4f36bd..ed52a018 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -81,7 +81,7 @@ AMR (for R) - 1.2.0.9024 + 1.2.0.9025 diff --git a/docs/index.html b/docs/index.html index 296fbceb..52659776 100644 --- a/docs/index.html +++ b/docs/index.html @@ -43,7 +43,7 @@ AMR (for R) - 1.2.0.9024 + 1.2.0.9025 diff --git a/docs/news/index.html b/docs/news/index.html index e8c386b5..cd378f4d 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.2.0.9024 + 1.2.0.9025 @@ -229,9 +229,9 @@ Source: NEWS.md -
-

-AMR 1.2.0.9024 Unreleased +
+

+AMR 1.2.0.9025 Unreleased

diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 51de5147..9342630f 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -10,7 +10,7 @@ articles: WHONET: WHONET.html benchmarks: benchmarks.html resistance_predict: resistance_predict.html -last_built: 2020-07-03T08:50Z +last_built: 2020-07-03T10:14Z urls: reference: https://msberends.gitlab.io/AMR/reference article: https://msberends.gitlab.io/AMR/articles diff --git a/docs/reference/index.html b/docs/reference/index.html index 0b3754f4..118cdf9f 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.2.0.9024 + 1.2.0.9025