【发布时间】:2017-06-30 01:49:55
【问题描述】:
我有一个带有一些文本数据的 df,例如
words <- data.frame(terms = c("qhick brown fox",
"tom dick harry",
"cats dgs",
"qhick black fox"))
我已经能够根据包含拼写错误的任何行进行子集化:
library(qdap)
words[check_spelling(words$terms)$row,,drop=F]
但鉴于我有大量文本数据,我只想过滤出现频率更高的拼写错误:
> sort(which(table(which_misspelled(toString(unique(words$terms)))) > 1), decreasing = T)
qhick
2
所以我现在知道“qhick”是一个常见的拼写错误。
然后,我如何根据此表对单词进行子集?所以只返回包含“qhick”的行?
【问题讨论】: