【发布时间】:2018-05-05 09:10:06
【问题描述】:
有人可以解释为什么 %in% 在这种情况下返回 false 吗?字符串<sentiment> 存在于较大的字符串中。
> x<-"hahahaha <sentiment>too much</sentiment> <feature>doge</feature>."
> "<sentiment>" %in% x
[1] FALSE
【问题讨论】:
-
%in%匹配 R 对象,而不是字符串中的单词。也许你想要grepl?