Skip to content

Commit 732f909

Browse files
committed
fix
1 parent 2c9032c commit 732f909

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

R/utils.R

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,3 +290,15 @@
290290
# no double white space
291291
insight::trim_ws(msg)
292292
}
293+
294+
295+
.fuzzy_grep <- function (x, pattern, precision = NULL) {
296+
if (is.null(precision)) {
297+
precision <- round(nchar(pattern) / 3)
298+
}
299+
if (precision > nchar(pattern)) {
300+
return(NULL)
301+
}
302+
p <- sprintf("(%s){~%i}", pattern, precision)
303+
grep(pattern = p, x = x, ignore.case = FALSE)
304+
}

0 commit comments

Comments
 (0)