Reputation: 463
there is a vecter
tmp <- c("a", "a.b", "c", "c.g.g", "rr", "r.t")
i want find index or true/false including "."
the result will be 2,4,6 or F T F T F T
how can i do?
Upvotes: 2
Views: 1125
Reputation: 30435
You can use grepl
and escape the .
.
> tmp <- c("a", "a.b", "c", "c.g.g", "rr", "r.t")
> grepl("\\.", tmp)
[1] FALSE TRUE FALSE TRUE FALSE TRUE
Upvotes: 4