mirror of
https://github.com/msberends/AMR.git
synced 2025-07-11 17:02:00 +02:00
(v1.3.0.9026) eucast expert rules 3.2
This commit is contained in:
12
R/like.R
12
R/like.R
@ -64,7 +64,7 @@
|
||||
#' }
|
||||
like <- function(x, pattern, ignore.case = TRUE) {
|
||||
# set to fixed if no regex found
|
||||
fixed <- all(!grepl("[\\[$.^*?+-}{|)(]", pattern))
|
||||
fixed <- !any(is_possibly_regex(pattern))
|
||||
if (ignore.case == TRUE) {
|
||||
# set here, otherwise if fixed = TRUE, this warning will be thrown: argument 'ignore.case = TRUE' will be ignored
|
||||
x <- tolower(x)
|
||||
@ -140,3 +140,13 @@ like <- function(x, pattern, ignore.case = TRUE) {
|
||||
"%like_case%" <- function(x, pattern) {
|
||||
like(x, pattern, ignore.case = FALSE)
|
||||
}
|
||||
|
||||
# don't export his one, it's just for convenience in eucast_rules()
|
||||
# match all Klebsiella and Raoultella, but not K. aerogenes: fullname %like_perl% "^(Klebsiella(?! aerogenes)|Raoultella)"
|
||||
"%like_perl%" <- function(x, pattern) {
|
||||
grepl(x = tolower(x),
|
||||
pattern = tolower(pattern),
|
||||
perl = TRUE,
|
||||
fixed = FALSE,
|
||||
ignore.case = TRUE)
|
||||
}
|
||||
|
Reference in New Issue
Block a user