str_detect函数属于tidyverse包中函数, 功能类似于grepl函数。 001、 str1 <- c("xx","yy","zz","xx","pp","xx") str1 grepl("xx", str1) str_detect("xx", str1)