【发布时间】:2016-09-16 06:38:56
【问题描述】:
我有一本带术语的字典
terms <- c("hello world", "great job")
terms <- as.data.frame(terms)
,我想在包含文档的附加 data.frame 中搜索第一个匹配项
doc <- c("i would like to say hello worlds", "hey friends hello world everyone", "i'm looking for a great job", "great job")
docs <- as.data.frame(doc)
期望的结果:
foundtext <- c("i would like to say hello worlds","i'm looking for a great job")
output <- cbind(terms, foundtext)
感谢您的帮助!
【问题讨论】:
标签: r regex match string-matching stringr