1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-09 06:51:48 +02:00

(v1.2.0.9025) AMR calculation speed improvement

This commit is contained in:
2020-07-03 12:14:41 +02:00
parent 46cf423eab
commit 2134fc76e2
11 changed files with 17 additions and 14 deletions

View File

@ -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