mirror of
https://github.com/msberends/AMR.git
synced 2026-11-16 06:30:48 +01:00
(v1.4.0.9052) replaced all sapply's with type-safe vapply's
This commit is contained in:
1 parent
ccf13dd6c0
commit
526f8afb08
37 files changed
+155
-117
No files matched your search
@@ -102,7 +102,7 @@ like <- function(x, pattern, ignore.case = TRUE) {
|
||||
res[i] <- grepl(pattern[i], x[i], ignore.case = FALSE, fixed = fixed)
|
||||
}
|
||||
}
|
||||
res <- sapply(pattern, function(pttrn) grepl(pttrn, x, ignore.case = FALSE, fixed = fixed))
|
||||
res <- vapply(FUN.VALUE = logical(1), pattern, function(pttrn) grepl(pttrn, x, ignore.case = FALSE, fixed = fixed))
|
||||
res2 <- as.logical(rowSums(res))
|
||||
# get only first item of every hit in pattern
|
||||
res2[duplicated(res)] <- FALSE
|
||||
|
||||
Reference in new issue
Block a user