【发布时间】:2015-10-28 20:36:20
【问题描述】:
我正在使用 R 进行字符串处理。我有一个带有一列字符串的数据框,比如:
df <- data.frame(textcol=c("In this substring would like to find the position of this substring",
"I would also like to find the position of thes substring",
"No match here","No mention of this substrangy thing"))
matchPattern <- "this substring"
我正在搜索一个函数(取决于某种距离参数,比如 Jarro-Winkler)将采用我的 matchPattern,将其与数据框文本列的每一行进行比较,并返回匹配的确切位置在匹配的字符串中,即第一个元素为 36(除非我记错了),第二个元素(可能)为 43,第三个元素为 NA,第四个元素为 14(?)。
【问题讨论】:
标签: r fuzzy-comparison