【发布时间】:2014-02-15 20:20:43
【问题描述】:
我目前在 data.table 代码中使用带有“lapply”的“agrep”函数将用户提供的 VIN# 列表中的条目链接到 DMV VIN# 数据库。到目前为止,请参阅以下两个链接以获取所有数据/代码:
Accelerate performance and speed of string match in R
Imperfect string match using data.table in R
有没有办法从我生成的列表中提取“最佳”匹配:
dt
因为到目前为止,'agrep' 函数给了我多个匹配项,即使对成本、全部、替换等进行了大量修改。变量。
我也尝试过使用 'adist' 函数而不是 'agrip' 但因为 'adist' 没有像 'agrep' 那样的 value=TRUE 选项,所以它会抛出相同的结果
Error in `[.data.table`(dt, lapply(vin.vins, function(x) agrep(x,car.vins, :
x.'vin.vins' is a character column being joined to i.'V1' which is type 'integer'.
Character columns must join to factor or character columns.
我之前收到的“agrep”。
还有其他我可以使用的包吗?
谢谢!
【问题讨论】:
标签: r text character string-matching