且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将字符串的每个元素与R中的单词列表进行比较?

更新时间:2023-02-05 14:20:33

我想我理解,但可能是错误的.您可以尝试:

I think I understand but could be wrong. You could try:

a  <- c("hi come asap, the $#!+ show is awsome", "I am suffering from cold")
d <- c("asap", "awsome", "cold", "lol", "rofl")

library(qdap)
mgsub(d, "", a)

收益:

> mgsub(d, "", a)
[1] "hi come , the $#!+ show is" "I am suffering from"