(v1.4.0.9052) replaced all sapply's with type-safe vapply's

This commit is contained in:
dr. M.S. (Matthijs) Berends committed 2020-12-28 22:24:33 +01:00
1 parent ccf13dd6c0
commit 526f8afb08
37 files changed
+155 -117

No files matched your search

+2 -2
View File
@@ -115,7 +115,7 @@ ab_from_text <- function(text,
translate_ab <- get_translate_ab(translate_ab)
if (isTRUE(thorough_search) |
(isTRUE(is.null(thorough_search)) & max(sapply(text_split_all, length), na.rm = TRUE) <= 3)) {
(isTRUE(is.null(thorough_search)) & max(vapply(FUN.VALUE = double(1), text_split_all, length), na.rm = TRUE) <= 3)) {
text_split_all <- text_split_all[nchar(text_split_all) >= 4 & grepl("[a-z]+", text_split_all)]
result <- lapply(text_split_all, function(text_split) {
progress$tick()
@@ -203,7 +203,7 @@ ab_from_text <- function(text,
# collapse text if needed
if (!is.null(collapse)) {
result <- sapply(result, function(x) {
result <- vapply(FUN.VALUE = character(1), result, function(x) {
if (length(x) == 1 & all(is.na(x))) {
NA_character_
} else {