I am trying to match string using agrep
function of R
. I do not understand, why it's not returning any value. I am looking a solution which will give closed match of the given text. In the given example it should show "ms sharda stone crusher prop rupa"
I would appreciate any kind of help. Thanks in advance.
x= as.vector(c("sharda stone crusher prop roopa","sharda stone crusher prop rupa"))
agrep("ms sharda stone crusher prop rupa devi",x,ignore.case=T,value=T,max.distance = 0.1, useBytes = FALSE)
character(0)
It is because of your max.distance
parameter. see ?agrep
.
for instance:
agrep("ms sharda stone crusher prop rupa devi",x,ignore.case=T,value=T,max.distance = 0.2, useBytes = FALSE)
"sharda stone crusher prop rupa"
agrep("ms sharda stone crusher prop rupa devi",x,ignore.case=T,value=T,max.distance = 0.25, useBytes = FALSE)
"sharda stone crusher prop roopa" "sharda stone crusher prop rupa"
agrep("ms sharda stone crusher prop rupa devi",x,ignore.case=T,value=T,max.distance = 9, useBytes = FALSE)
"sharda stone crusher prop rupa"
agrep("ms sharda stone crusher prop rupa devi",x,ignore.case=T,value=T,max.distance = 10, useBytes = FALSE)
"sharda stone crusher prop roopa" "sharda stone crusher prop rupa"
If you want only the closest match see: best match