From 2108aa1223fcc8156545eb607f41729ebb96ace7 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 12 Sep 2023 14:35:14 +0200 Subject: [PATCH] fix --- R/seek_variables.R | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/R/seek_variables.R b/R/seek_variables.R index 73379d7a7..86abffd66 100644 --- a/R/seek_variables.R +++ b/R/seek_variables.R @@ -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))) } } } @@ -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))) } }