Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Sep 12, 2023
1 parent 1043c74 commit 2108aa1
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions R/seek_variables.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ seek_variables <- function(data, pattern, search = c("names", "labels"), fuzzy =
if (fuzzy) {
found <- .fuzzy_grep(x = labels, pattern = search_pattern)
if (length(found)) {
pos2 <- c(pos2, names(labels)[found])
pos2 <- c(pos2, match(names(labels)[found], colnames(data)))
}
}
}
Expand All @@ -110,15 +110,11 @@ seek_variables <- function(data, pattern, search = c("names", "labels"), fuzzy =
found <- vapply(
values,
function(i) {
p <- .fuzzy_grep(
x = i,
pattern = search_pattern
)
!insight::is_empty_object(p[1])
length(.fuzzy_grep(x = i, pattern = search_pattern)) > 0
},
logical(1)
)
if (length(found)) {
if (any(found)) {
pos3 <- c(pos3, match(names(found)[found], colnames(data)))
}
}
Expand Down

0 comments on commit 2108aa1

Please sign in to comment.