【发布时间】:2020-02-13 12:02:21
【问题描述】:
我有一个字符串关键字向量和一个包含许多字符串元素的列表。我想保留列表中至少包含一个来自向量的字符串的元素。
我已尝试使用 dplyr、%in% 等进行过滤。
这是一个例子:
words <- c("find", "these", "words")
paragraph <- list(text1 = c("these", "words", "are", "helpful"),
text2 = c("nothing", "to", "see", "here"),
text3 = c("we", "can", "find", "one", "here"))
我希望得到一个仅包含 text1 和 text3 的列表。
谢谢!
【问题讨论】: