I am using the stringdist
package in R
.
For several options:
grab(x, pattern, maxDist = Inf, value = FALSE, ...)
grabl(x, pattern, maxDist = Inf, ...)
extract(x, pattern, maxDist = Inf, ...)
it uses maxDist
. This option however counts the distance between A
and a
as one. Just as the distance between A
and b
. I would like ignore the letter case, for maxDist
. Does anyone know how?
CodePudding user response:
You can use tolower
and write your pattern in lowercase to ignore case:
x <- "Abc"
stringdist::extract(x, pattern = "abd", maxDist = 1)
#> [,1]
#> [1,] NA
stringdist::extract(tolower(x), pattern = "abd", maxDist = 1)
#> [,1]
#> [1,] "abc"
Created on 2021-11-04 by the reprex package (v2.0.1)