1
0
mirror of https://github.com/msberends/AMR.git synced 2025-06-07 19:14:01 +02:00

(v2.1.1.9281) speed improvement is_sir_eligible

This commit is contained in:
dr. M.S. (Matthijs) Berends 2025-05-20 11:31:42 +02:00
parent 26447fe29b
commit a94452b9be
No known key found for this signature in database
3 changed files with 5 additions and 5 deletions

View File

@ -1,6 +1,6 @@
Package: AMR Package: AMR
Version: 2.1.1.9279 Version: 2.1.1.9281
Date: 2025-05-16 Date: 2025-05-20
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)
data analysis and to work with microbial and antimicrobial properties by data analysis and to work with microbial and antimicrobial properties by

View File

@ -1,4 +1,4 @@
# AMR 2.1.1.9279 # AMR 2.1.1.9281
*(this beta version will eventually become v3.0. We're happy to reach a new major milestone soon, which will be all about the new One Health support! Install this beta using [the instructions here](https://amr-for-r.org/#get-this-package).)* *(this beta version will eventually become v3.0. We're happy to reach a new major milestone soon, which will be all about the new One Health support! Install this beta using [the instructions here](https://amr-for-r.org/#get-this-package).)*

View File

@ -445,9 +445,9 @@ is_sir_eligible <- function(x, threshold = 0.05) {
%in% class(x))) { %in% class(x))) {
# no transformation needed # no transformation needed
return(FALSE) return(FALSE)
} else if (!all(is.na(x)) && all(toupper(x) %in% c("S", "SDD", "I", "R", "NI", NA))) { } else if (!all(is.na(x)) && all(x %in% c("S", "SDD", "I", "R", "NI", NA, "s", "sdd", "i", "r", "ni"))) {
return(TRUE) return(TRUE)
} else if (!all(is.na(x)) && !any(c("S", "SDD", "I", "R", "NI") %in% gsub("([SIR])\\1+", "\\1", gsub("[^A-Z]", "", toupper(x), perl = TRUE), perl = TRUE), na.rm = TRUE)) { } else if (!all(is.na(x)) && !any(c("S", "SDD", "I", "R", "NI") %in% gsub("([SIR])\\1+", "\\1", gsub("[^A-Z]", "", toupper(unique(x[1:10000])), perl = TRUE), perl = TRUE), na.rm = TRUE)) {
return(FALSE) return(FALSE)
} else { } else {
x <- x[!is.na(x) & !is.null(x) & !x %in% c("", "-", "NULL")] x <- x[!is.na(x) & !is.null(x) & !x %in% c("", "-", "NULL")]