检查文本是否在R中的另一个变量中的最佳方法是什么?以下是一个例子:
a= 'homer simpson the third'
b= c('homer simpson','marge','bart')
grepl(a,b)
# this is what it returns
FALSE FALSE FALSE我想要它还真假假。
发布于 2022-11-28 23:14:33
也许,为agrep使用max.distance的自定义值
agrepl(a, b, max.distance = 0.5)
[1] TRUE FALSE FALSE原因是b的每个元素似乎都是'a‘模式的子字符串。
https://stackoverflow.com/questions/74607468
复制相似问题