📌  相关文章
📜  检查列 R 中是否包含字符串 - 无论代码示例

📅  最后修改于: 2022-03-11 14:58:23.686000             🧑  作者: Mango

代码示例2
fruit <- c("apple", "banana", "pear", "pinapple")     # [1] TRUE
identical(str_detect(fruit, "a"), grepl("a",fruit))   # [1] TRUE
identical(str_detect(fruit, "^a"), grepl("^a",fruit)) # [1] TRUE
identical(str_detect(fruit, "a$"), grepl("a$",fruit)) # [1] TRUE
identical(str_detect(fruit, "b"), grepl("b",fruit))   # [1] TRUE
identical(str_detect(fruit, "[aeiou]"), grepl("[aeiou]",fruit)) # [1] TRUE