mirror of
https://github.com/msberends/AMR.git
synced 2025-07-08 18:01:50 +02:00
(v0.7.1.9024) eucast_rules() fix, new MOs
This commit is contained in:
6
R/like.R
6
R/like.R
@ -76,7 +76,11 @@ like <- function(x, pattern) {
|
||||
if (is.factor(x)) {
|
||||
as.integer(x) %in% base::grep(pattern, levels(x), ignore.case = TRUE)
|
||||
} else {
|
||||
base::grepl(pattern, x, ignore.case = TRUE)
|
||||
tryCatch(base::grepl(pattern, x, ignore.case = TRUE),
|
||||
error = function(e) ifelse(test = grepl("Invalid regexp", e$message),
|
||||
# try with perl = TRUE:
|
||||
yes = return(base::grepl(pattern, x, ignore.case = TRUE, perl = TRUE)),
|
||||
no = stop(e$message)))
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user