【发布时间】:2021-08-02 10:45:53
【问题描述】:
我提到了这个问题 (How to filter Exact match string using dplyr),但我的问题略有不同,因为这个词不是开头,而是可以出现在字符串中的任何位置。我希望 TRUE 只返回第一个而不是第二个和第三个
library(stringr)
vec <- c("this should be selected", "thisus should not be selected","not selected thisis too")
str_detect(vec,"this")
电流输出
TRUE TRUE TRUE
预期输出
TRUE FALSE FALSE
【问题讨论】: